I'm not a parent myself so hopefully some other folks with kids of their own can share their thoughts. I just wanted to say that children deserve a parent and partners deserve a spouse who loves them unconditionally and wants what is best for them– and I can tell from your post that that is just the case here. I don't have too much specific to add other than this poem that my mother kept on the fridge when I was a kid that I found very moving, and lord knows I could be testing at times:
When children try your soul, as they will,
When they cause you grief, as they do,
When they rouse your anger and provoke your wrath, as is their way,
When they reduce you to tears and prayer, as often happens,
Don't bother about anything at all
Until you have first made clear to yourself
That your love for the child in question
Is holding firmly, swelling warmly in your heart.
Then, whatever you do will be as nearly right
As it is possible for human judgment to be right.