Something strange happened in gender theory in recent years.
Long ago, when conservatives and bigots dominated society, gender was virtually unknown. There was only sex, and it was biological: chromosomes, hormones, body parts like testicles and the vulva etc... and the social roles men and women were supposed to play in society were determined by biology.
Biology was the essence of sex.
Then came gender theory and invented, well, gender: the socially constructed roles people play in society: masculine or feminine men, masculine or feminine women, third genders, gender fluidity, non-binary people.
The next stage was radical gender theory, with its prototype and leader Judith Butler: biological sex as something natural disappeared completely, everything regarding gender was constructed, even those aspects that used to be biological. Gender was pure performance and social construction. There was no longer any male or female "essence". Even the word "sex" disappeared (except when talking about "having sex" )
And now, in recent years, we've reached the ultimate stage, lets call it gender theory 2.0. Now, mysteriously, essence is back, but not as biology (which has become totally irrelevant), but as a strange entity called "gender identity". One is a man or a woman, because one self-identifies as such. Like biology, identity is innate; it cannot be changed; it is not constructed; it can only be discovered, but only by every person him- or herself, by pure introspection. It cannot be verified from the outside (for example by looking at the body)
In a certain sense, we have come full circle: from sex as biological essence, to gender as 100 percent construction and performance, back to male or female essence, this time a sort of spiritual essence called identity, a "sexed soul".
To point out your beginning fallacy, there are 11 chromasonal 'sexes, so it was not chomasonal. as far as gender goes the ancient hebrews identified 4 genders at birth, male, female, both male and female and neither male or female.
The study of sex and gender did not begin with Kinsey (1948) or Masters and Johnson (1957-1990) but your observations need work and a new lens.