what is troubling about your post is not the problems you're facing: they are very common. I don't mean to play them down only to underline the fact that people the world over have emotional breakups to contend with daily. What I (and anyone willing to look) can see is how ready you are to denigrate yourself, close all your doors, trap yourself in a self destructive way. That is what you have to stop doing, immediately. You are as worth while as anyone else, with all the possibilities for growth and change. And it is likely that you have strengths you've never thought possible. But first of all you must stop attacking yourself. It's the worst thing you can do; it won't help or lower your level of anxiety. Beating yourself over the head will not make it any less painful when someone else does it. That's the major reason people do it. It's like saying if I put myself down when someone else does it, it wont feel so bad. Yes it will! We are social creatures and need the respect and acceptance of those around us.
Consider what you're saying about your relationship with your children, how much you love them. Obviously you are and have been a good father. That's a real achievement; take credit for it! It's also likely that you've been a good and loving husband too. It's is never completely clear why people end marriages, why one what's to stay and the other one wants to leave. Don't take all the blame. It may not be a matter of blame. You're too quick and to eager to plunge into self reproach.
If as you say you're suffering from depression and anxiety resulting from a traumatic childhood, then take heart. I've been there too. I found a good therapist and later a group of men who were having the same experience and over time I learned how to like myself and grow my self esteem. Above all else, I learned not to attack myself but rather to see myself as the hero of my story. You too can do that and must for the sake of your children and youself. No one can turn your children against you if you go on showing them you love them by being there for them when they need you. Even if they end up living with you ex-wife, they will respond to you based on how you treat them and the love you express when they are with you. Children judge us not by what people say, but by what we do or don't do for them.
Now take a good look at yourself in the mirror and say "I'm going to get through this and be a much better person for it because on many levels I like myself. I'm going to take that and build on it so that my children will benefit from it. Things may look dark now, but tomorrow they're going to be bright because I'm basically a good person." Say that to yourself everyday as many times as necessary. Push negative thoughts away. They only bring you down. You have a lot going for you, if you'll only look. In short, take this lemon and make some lemonade. Remember we are here for you, but we can only be supportive; you have to take the steps that will change the way you see yourself. Yes, if you're able find a Therapist or group and start working on changing your image of yourself. Hang in there and all the very best.