“How about we just check your chromosomes? If you are XX, you’re female. if you are XY, you are male.”
True. Except: https://www.nlm.nih.gov/medlineplus/ency/article/001180.htm
https://en.wikipedia.org/wiki/Complete_androgen_insensitivity_syndrome
Example of person with CAIS: https://www.youtube.com/watch?v=7ng2OXECkC8
I am aware there are some rare exceptions. Those people may be handled differently.