I don't disagree with anything you've said here (you aren't saying anything I find personally objectionable) and I welcome the correction to my generalised point about evolutionary adaption retaining these non-binary traited individuals.
Your summary is basically correct: we have intersexed people whose phenotypes don't match their sexual genotypes.
In addition, we have transgender people whose neurotypes don't match either their genotypes or phenotypes.
Here's an example of the kind of peer-reviewed papers I'm talking about, this one from 2018:
Transgender brains are more like their desired gender from an early age
Brain activity and structure in transgender adolescents more closely resembles the typical activation patterns of their desired gender, according to new research. The findings suggest that differences in brain function may occur early in development and that brain imaging may be a useful tool for earlier identification of transgenderism in young people.
Dr Bakker says, "Although more research is needed, we now have evidence that sexual differentiation of the brain differs in young people with GD, as they show functional brain characteristics that are typical of their desired gender."
And this one from earlier in the year (April 2019):
Sex differences in functional connectivity during fetal brain development - ScienceDirect
Sex-related differences in brain and behavior are apparent across the life course, but the exact set of processes that guide their emergence in utero remains a topic of vigorous scientific inquiry. Here, we evaluate sex and gestational age (GA)-related change in functional connectivity (FC) within and between brain wide networks....
We discovered both within and between network FC-GA associations that varied with sex. Specifically, associations between GA and posterior cingulate-temporal pole and fronto-cerebellar FC were observed in females only, whereas the association between GA and increased intracerebellar FC was stronger in males. These observations confirm that sexual dimorphism in functional brain systems emerges during human gestation.
If studies like the above are right, the implication would be that whilst one's genotype sex is determined chromosomallly at conception, sexual dimorphism in the brain is a secondary process that occurs
in utero (in the womb).
This means that gender dysphoria - the feeling that one's gender does not match up with one's physical sex - may be caused by the exposure of foetuses
in utero to hormones or indeed foetal insensitivity to certain hormones while in the womb, and that the brains of transpeople neurochemically align with the structure and activation pattern of their 'acquired' gender, and not their natal sex.
Where I would disagree a little, is that I don't think acceptance of these people is just a modern Western civilizational trait.
For whatever reason, our human species has proved particularly adept at finding ways of accomodating them, compared to other species.
The 12th-century
Decretum Gratiani was the medieval church's primary codex of canon law until reform in 1918 (for instance).
It recognises three sex categories: male, female and hermaphrodite. Of the latter it establishes a legal doctrine: "
Whether an hermaphrodite may witness a testament, depends on which sex prevails" ("Hermafroditus an ad testamentum adhiberi possit, qualitas sexus incalescentis ostendit."):
"...
On persons and the divisions of persons.
There six divisions of persons. The first is this one: All humans are either men, or women, or hermaphrodites. […]
Hermaphrodites are those who have both sexes, that is, male and female. For them, the following rule is given: That either the female sex prevails, and they thus are regarded as women, or the male sex prevails, and they thus are regarded as men. Therefore, the threefold division can be reduced to a binary division, because [hermaphrodites] belong to the first [division], if the male sex prevails, or the second, if the female sex prevails."
What factors determine which 'sex prevails' in a given person who is intersexed/ambiguous in some way?
Another twelfth century canon lawyer,
Huguccio, set out guidelines: "
If someone...always wishes to act like a man (excercere virilia) and not like a female, and always wishes to keep company with men and not with women, it is a sign that the male sex prevails in him...If therefore the person is drawn to the feminine more than the male, the person does not receive the order".
In 1271, another influential canon lawyer named Hostiensis likewise argued that hermaphorodites should choose their legal gender under oath:
"
I reply: s/he may say which sex s/he chooses, as our diocesan bishop, the bishop of Turin [demanded in this case];; and s/he may swear further- more not to use the other one." (
Summa aurea ( n. 66), col. 612)
To reference an academic study on this from 2014 (
The two laws and the three sexes: ambiguous bodies in canon law and Roman law (12th to 16th centuries)) by the historians Christof Rolker and Andreas Thier:
https://www.google.com/amp/s/www.re..._law_and_Roman_law_12th_to_16th_centuries/amp
Canon law in theory and practice did reckon with hermaphrodites as a 'third sex’, bodily distinct from men and women. My overall impression is that law and society weren't overly concerned with unusual genital anatomy and did not scandalize changes of sex or gender. This in practice seems to have given hermaphrodites considerable individual freedom, including a choice of gender, whether they had previously lived as men or women.
In Ancient India, likewise, we find this:
Hijra (South Asia) - Wikipedia
The ancient Kama Sutra mentions the performance of fellatio by feminine people of a third sex (tritiya prakriti).[49] This passage has been variously interpreted as referring to men who desired other men, so-called eunuchs ("those disguised as males, and those that are disguised as females",[50] male and female trans people ("the male takes on the appearance of a female and the female takes on the appearance of the male"),[51] or two kinds of biological males, one dressed as a woman, the other as a man.[52]
Franciscan travelers in the 1650s noted the presence of "Men and boys who dress like women" roaming the streets of Thatta, in modern Pakistan.