>checking for Y chromosomes doesn't do it
Lol why does this not do it?
Because in a specific minority of the population it disagrees with the gender assigned at birth for obvious reasons. There are plenty of resources you could read on intersex instead of lol at something you don’t understand
https://en.wikipedia.org/wiki/Androgen_insensitivity_syndrom...
Among others