I forget the word, but it's longer than I can spell; but it's meaning is clear - "good things can come from bad experiences."
I deeply believe that, and when things aren't going well, for whatever the reasons, I start reflecting on what it is that I'm supposed to learn from the experience. That helps to lift my spirits and keep me going in a positive experience.
It's the same with relationships. I've been dogged, too; but feel that the bad ones have helped me to clarify what I expect. For example,I now set my expectations high and would rather not be bothered with someone who is trifling.
So, I can thank people who I've been in bad relationships, too. I guess it's part of the experience of growing from child to adult...and then we mature!