How much literature is filled with flawed relationships, and damaged individuals? I would hazard a guess at a large percentage. I don't think that children's literature should be any different, my Dc have read a wide range of books where various characters have treated each other very poorly, and it provides good opportunity for discussion, rather than role models.
It is the relationships that children see modelled in real life that have the most effect on them as they grow up.
I'm sure that JKR's own relationships influenced the books as she wrote them, I think it's inevitable. There are many many people in relationships, both men and women, who have ended up in long term relationships with people who have not treated them well. That's human nature, and it's how growth and learning occurs, however painful the process is.
I have just been through long term therapy to understand why I ended up in a very unhealthy relationship. Spoiler - it wasn't because of the books that I read.