There are many reasons why judges do not automatically accept children's wishes about custody. Children can choose to live with the parent they feel needs them. That puts the child into a parental role which is harmful. It is the parents' job to take care of the children, not vice versa. That fantasy seldom turns into reality.
Children can choose to live with the parent who has more money.
If courts approved such a decision, materialism would become even worse than it already is. The law promotes the goal of putting money where the children are, not putting children where the money is. In other words, what a child wants is often not what a child needs. Where a child of divorced parents is to live is a decision for grown-ups to make. Judges hope the parents themselves will come to an agreement and abide by it.