Having read the judgment, I think the judge did the right thing to protect the child. Para 74 of the judgment seems to be the crux of the decision to place the child with the father:
"My experience in the Family Division leaves me with little doubt that some children, as young as 4, 5, 6 years of age may identify strongly with their opposite gender. Such children can experience rejection and abuse arising from ignorance both on a personal and institutional level. Though none of the parties referred me to it, I have read the House of Commons Select Committee report 'Transgender Equality', dated 14th January 2016, which investigates the challenges in securing sensitive NHS care and accessing affirming educational environments for transgender adults and children. It is important that such children are listened to and their views afforded respect but, to my mind, they are ill served by premature labelling. What they require, as F has so capably demonstrated, is the opportunity to develop their identity in which ever way it evolves. J was not only deprived of that space and opportunity by his mother, he was pressed into a gender identification that had far more to do with his mother's needs and little, if anything, to do with his own. "
From the outset it appears the various authorities appear to have been sucked into the 'but he's a girl' story of the mother, without there being any actual evidence. "There was no independent or supportive evidence that J identified as a girl at all, indeed there was a body of material that suggested the contrary."
Also, the mother's behaviour as recorded in the judgment appears to be both concerning and highly inappropriate.