J. K. Rowling has made the terrible confession that she made her marriage choices (at least the one for Hermione) for "personal reasons." And she said it as if it were some sort of awful betrayal of her readers.
The fact is, there are always several ways a story could go. What's important is that the choices made fit the rest of the story and as much of the real world as the story world intersects with, which in the case of character behavior, means human nature (if the characters are human, and sometimes if they're not). And human nature, messy, fickle thing that it is, has plenty of wiggle room.
So, does the Hogwarts kids' choice of life mates really violate either their characters or human mating patterns in general? I don't think so. It frequently happens that young people who have been very close friends from childhood and from that beginning flirt with romance as teens, wind up marrying other people. As for the lead male and the lead female in fiction getting together at the end, that's contrived, as satisfying as it may be. (I personally prefer satisfying and contrived, and still think Anna should have married the King of Siam, because they sang a duet together, but I have the maturity of a three-year old who loves musicals.)
All of the kids, Ginny included, once she enters the series, are good friends and have bonded through life-threatening adventures. Ginny is pretty and fun, and shares Harry's love of Quidditch. Ron's biggest strong points, that he's a nice guy and comes from a loving family and thus has had a role model for being a good family man, make him a great catch for the long run. Literarily, the story of Ginny and Harry's relationship unfolds over several volumes of the series. Hermione and Ron interact throughout the entire series; the theme of romance finally blossoming with a partner one is at odds with or thinks of the other as dorky or annoying or just a pal is a common one in romance novels.
But the main point is this:
In spite of all the talk of stories "writing themselves" and "wanting to be told," characters "having a life of their own" and "surprising the author with what they do," the prosaic fact is that ordinary, human authors actively, of their own imaginations, write stories. It is an act of the will as much as an act of the Muse. All of it, from the most sophomoric Lt. Mary Jane fanfic to the best serious literature, boils down to some person writing down a personal fantasy. It needs no apology.