The job of the judge in a custody case is to listen to all of the evidence, and decide what is best for the kids. This doesn't always happen. Family judges seem to fall on one of two ends of the spectrum. Either they despise family law and would rather not hear anything other than the bare minimum or they think their job is to make everybody happy, and in doing so, fail to hold the parents accountable for their bad actions as parents.
There are all kinds of fancy, trendy "services" out there that make plenty of buck from this kind of court order. Parent coordinators. Reunification counselors. Custody evaluators. The list is endless. And the problem is not that these services exist, it is that these folks too often suffer from the same myth the judges do, that after the litigation is over, with a little (or a lot) of help, the parents will magically be transformed into kind (or at least functional) parents.
Down where I come from, we have a word for that, but like Auntie Em in the Wizard of Oz said, "I can't repeat 'em because I'm a good woman."
One answer that actually works is when courts acknowledge the fact of the dysfunction. It's happening in courts all over the country, specifically (of course) in Southern California, where the courts require what they call "recidivist" cases (meaning the ones that keep coming back) into high-conflict parenting classes. These courses specifically do not expect couples to try to just get along, they teach parents what is known as "parallel parenting." The theory goes that if one parent is reasonably sane (and this is often the case) that person can learn not to engage with the other parent, but to parent on a parallel track that doesn't give the less capable parent the chance to use the kids (and the legal system) to champion their personal cause.
For more information, here is a link to some of the best education out there on how to make this work: Deena Stacer, Ph.D. - Part 1 of Online Course
