Ok, so why Harry gets Ginny and Ron gets Hermione? Simple story dynamics, folks, based on the available women.
If Harry gets Hermione, then Ron becomes the perpetual third wheel. Not a good fate for the best friend.
But if Harry gets Ginny, then Ron's his eventual brother-in-law. And if Ron gets Hermione, then everybody's family in the end, which is a pretty satisfying way to end up.
The triangle is unstable, but the square isn't.