I am still very early in this whole process, and there is still a lot of self doubt, so I am reading a lot of literature on "Am I trans" and dysphoria.
One concept that people often like to propose in these ressources is the button that makes you the opposite gender, and, crucially, also makes everyone else believe that you have been that way forever.
I don't really like this, because my time as a boy/man is part of who I am. I would not be me without it, and despite all of the problems I had and have due to my gender, it is still part of who I am. I fought through all of this and worked to find out who I want to be by myself. I wouldn't wanna be cis, and I also don't want to cease being the me born out of this struggle.
My theory is that primates ( among other animals, perhaps) have the instinctual tendency to imprint behaviors from their social group, which manifests as self-idendifying as a member of that group. Gender identity is a form of this instinct to self-identify, which primes people to imprint/identify with gendered subgroups within their group.
As "male" and "female" behavior groupings can serve the function of genetic propagation (e.g. "men and women fuck and have babies") these identities appear to exist for most or all animals, and within every society. The complexity of human culture, and the indef-gtability of biological categorization, allow room for the development of genders beyond the two listed previously, giving rise to nonbinary gender identities. To put it another way, an individual may not have male-typical or female-typical imprinting tendencies, but something less common or even novel. Human culture can adapt to this, when recognized and acknowledged.
Most people, being cis, find this process as invisible as imprinting language. They have an internal imprint/identification tendency that readily aligns with the most common sexual categories (male and female), and this reinforces their senses of self-identity. Trans people must contend with the contradiction of being socially and sexually identified as one group while fundamentally primed to imprint, and therefore identify, with the other. Nonbinary people may find themselves trying to fit an existing social group that most closely matches their sense of self, or they may attempt to carve out their own categories, ideally with the endorsements of their social groups.