A plot could be built around a mystery. In the third year, there's a mysterious object or event that only Harry and Hermione seem to be able to solve. As they work together closely, they grow closer. The kiss could be a moment of celebration after they solve the mystery, or it could be a moment of realization during the investigation that they have deeper feelings for each other.
The plot could involve a magical mishap. For example, a spell goes wrong during a third - year Defense Against the Dark Arts class. This spell somehow makes Harry and Hermione's hidden feelings for each other surface. As a result, they share a kiss, which then leaves them both confused and trying to figure out what this new development means for their friendship.