I am wondering if the best thing you could have done was to reverse the situation for now and have let him try to work things out with B. He has feelings for her and I have no doubt that his love for the kids is a huge a factor in his quandary. He may view himself as their protector if B is as crazy to them as she is to him. However, I would bet having had a sane gf, he would find B's behavior even less tolerable than before he met you.
Here is where I am coming from: I joined a couple. Turns our the wife was emotionally to her husband. He didn't like it, but thought that is just how things were. However, I am emotionally stable and easy going. The husband quickly discovered that not all women are mercurial lunatics, and that changed much in his point of view.
I left. He tried for a year to get her to quit using him as an emotional punching bag. They are currently in divorce proceedings, and he and I are slowly rebuilding.