I can certainly relate to your questioning of what you did wrong. I struggled with that for a really long time as well.

While you certainly played a part in the demise of your marriage, you were willing to work to resolve the issues. Your STBXW wasn't, and that's where it becomes her issue.

Ruminating on what you could have done differently only serves to keep you imprisoned. Certainly learn from your mistakes so you don't repeat but also realize you are imperfect, always will be.

Sometimes you can be the perfect partner for someone, and they will still find a reason to leave.