People get divorced for all sorts of reasons. Perhaps the mother was abusive, Or is not fit to look after the child? Just because she is a women, The child equally belongs to the father as much as they belong to the mother. Whomever has custody should be decided in the interest of the child, And what is best for them.
This is a topic which has troubled me, And I honestly do not know what the best way of settling this is. But I know that white people are not automatically more trustworthy than black people. Jews are not inherently better people than Muslims. Single mothers are not naturally healthier parents than single fathers.
This said, This is not a light topic. But it is only dependent on what environment will raise the child best. The parent must provide, Nurture, Teach, And protect the child regardless of his/her gender.