Your gender is something you recognise in yourself, partly because it is recognised in you by others. So, gender is held in place by a combination of biology, recognised relationships and then, I guess, habit.
Sexuality also plays a key role in gender identity: who you are expected to want to shag. Children start to play-act these relationships before puberty. I’m sure we all remember when we were about 10 or 11 and the playground alpha males started to “go with” the playground alpha females, but (rather sweetly) they had no idea what to do with each other, so that the relationship would last a week and they wouldn’t spend any time together.
For most people, even traditionally minded patriarchs, sexual acts, even the most exploitative, are relationships between two breathing, thinking individuals. You may be too selfish to bother with your partner’s thoughts or needs, but you have the capacity: the concept of self and mind. In all my sexual fantasies, for example, I used to be in a relationship with the desired person, which is why they were so willing to fuck my brains out.
I’m acutely aware of this immediate and automatic conception of other selves, because it was that profound sense of depth and significance to others that I lost when I was acutely underweight. I might tell you exactly how somebody might react to something, what they might say or think, but it held no fundamental importance. It felt like reading out the temperature on a thermometer or the numbers on a spreadsheet. (I didn’t see any greater importance to my own thoughts or feelings, either.)
I realised then that this was perhaps the greatest and most precious gift of human sentience.
The lack of it damages the sense of self, including conceptions of gender identity and sexuality.