There's some truth to it. I don't think it's because we explicitly like toxic people, but rejection, thinking "you're" the problem, and thinking you can change someone can kinda have you holding on to something you shouldn't.
I got sprung and loved some chicks that did me absolutely dirty, thinking that they would come around. I usually/used to get it fukked up because the moment some did some shady shyt, I'd cut them off. But then they'd apologize or say it was a miscommunication, which bought them some benefit of the doubt, but then they'd double down and do something even more fukked up... It was a stupid cycle I went through... and sometimes still go through, but the slack is a lot less now.
Men and women both do this though. As I get older, I realize we're both on the same bullshyt.