Y’know, the thing that really bothers me about HP isn’t that Lily ends up with James, but that Lily is heralded as some sort of paragon of virtue whilst simultaneously marrying someone who viciously bullied another kid at their school. And not just any kid, her previous best friend. Personally, I can’t parse that. I don’t see that James could’ve changed enough for Lily to be interested in him, particularly as we learn that he continues his vendetta with Severus behind Lily’s back.
But she was. She was more than just interested - she married him, and bore him a child. And perhaps we can say that James just acted brilliantly around her, and that she was somewhat unaware of the extent of his previous behaviour, and he managed to convince her that he was different.
But then I sometimes consider the uncomfortable suggestion that Lily wasn’t that nice a person. Petunia certainly isn’t, and perhaps the apple doesn’t fall from the tree. I might appreciate Severus as a character, but he’s hardly impeccably behaved - yet Lily was his best friend for years. James was a merciless bully and she married him. Sirius, James’ best friend, tried to murder a classmate (again, not any classmate, but her ex-best friend!) - and she welcomed him into the family. Peter, another of James’ best friends, was entrusted with their safety - not because he was beloved but because they thought that he was inconsequential.
And sometimes, if you step back and look at the characters in that framing, you think, “Actually, they’re all terrible people.” Lily, perhaps, included.