OP: You are in a really tough predicament - I don't think anybody responding to your post underestimates that.
Kangaroo's post is a vivid description of what can happen down the line in situations such as yours. Too often it ends up with a lot of adults feeling vindicated that they acted reasonably given their own feelings, etc., etc., and the kids being the ones who really pay the price. Things are tough for everybody, but they are always toughest for the kids because they have to somehow find a way live in both 'camps', each of which wants its own point of view to be properly understood and considered. However difficult it is for the adults, they're stronger and have greater resources for dealing with these things than children (or they should have!). They have greater freedom, more power and more choices. You may not feel you do at the moment, but you do.
Don't be hard on yourself for feeling aggrieved. It sounds like you have every right to be. When a relationship ends, feelings of resentment and disappointment are normal and very often justified. Regardless of the circumstances it's always impossible to avoid a sense of failure and that too is very painful. You're allowed to have all these feelings and to express them (you'd be a robot or a some kind of seriously inhuman person if you didn't).
Where you do have to be hard on yourself is making sure your sons are not involved in any part in this process. Your job is to worry about and help them with their problems. It is not their job to do the same for you.
You may be like some of the posters here and still feel very raw about it several years on. It doesn't have to be like that and I hope it's not for you. What often keeps these things alive for the parents is the continuation of the conflict through the children. That will be bad for you and even worse for them. Enjoy your kids, be the best mum you can for them, get over your ex and move on with your life.
I hope this ex of yours turns out to be a better father to his sons than he turned out to be a partner to you. It's in the interest of your sons that he is, so you should hope for this too.