Not really. Gender is different from sex. When someone says there are only two genders what theyre usually talking about is male and female
gender identity is much more of a spectrum and more distant from sex. Someones sex could be biologically male, but that doesnt matter as much as their gender identity is, idk feminine looking non-binary. And that excludes all the weird shit biology also does like intersex people