I've identified why: I'm attracted to toxic relationships.
I even have at least some idea as to why I'm attracted to them: If I'm dating someone who has a bunch of bullshit to deal with, I'm hoping my flaws won't seem as bad by comparison and will go unnoticed
This is insightful and I applaud your self-honesty in this assessment. And, it really shows your way forward. The most important thing is to learn to be comfortable in your own skin and fix any flaws that are worthy of fixing. And, not all may not actualy be flaws. So, a bit of wisdom is required to determine which ones are flaws and then to address them.
If you can do that, I think the problem of being attracted to toxic relationships will go away. But, you need to address the underlying problems. I mean, avoiding toxic relationships is good but, without addressing the true problems rather than the symptoms, you'll continually be drawn to them.
And, congratulations on losing weight!