I'll start with Mosby's medical dictionary:
"the inner sense of maleness or femaleness. Differentiation of gender identity begins in infancy, continues throughout childhood, and is reinforced during adolescence. Also called core gender identity."
McGraw Hill medical dictionary: "Core gender identity 'The inner conviction that one is male, female, ambivalent, or neutral.'GI is a major personality trait, that develops in the first 2 yrs of life, and is 'fixed' by the 3rd yr."
Collin's medical dictionary " The inherent sense that one belongs to a particular sex. In almost all cases that sex corresponds to the anatomical sex, but for a small minority, the gender identity is for the opposite anatomical sex."
The American Association of Psychiatry defines it as "(the psychological sense of being male or female)" alongside sexuality and social gender role.
The APS defines it as "to one’s internal sense of being male, female, or something else."
Compare that to the definition of soul:
The spiritual part of a person that some people believe continues to exist in some form after their body has died, or the part of a person that is not physical and experiences deep feelings and emotions.
dictionary.cambridge.org/dictionary/english/soul
Gender identity genuinely has no definition that is logically coherent (i.e. what does it "feel like" to be male or female or "something else"? And what is that "something else" in a sexually dimorphic species?). It is a false assumption that everyone has a gender identity, simply because a (likely aetiologically heterogenous) group of people are distressed over their sexed bodies or gender role in society. As mentioned before, even within the trans umbrella there is neutrois: a gender identity that doesn't have a gender identity. How does that fit in with all this?
Gender identity, I think, is a term medical professionals and trans people are using to give language to the phenomenon of people who believe they are (or should be) the opposite sex. Probably because the word "delusion" is rightly felt to be too harsh. But I would argue that the definition of the word delusion as a fixed false belief is reasonably applicable to this context. The fixed belief one is the opposite sex is demonstrably false. I am really sorry, but this is just a fact. So in order to avoid calling what is going on with trans people a delusion, one needs to construct another concept: gender identity. The fixed belief one has this other thing called a gender identity, and that it is not matched with one's sex, is as demonstrable as the existence of a soul. Both are completely internal and intangible. So you can't call someone's belief in a specific gender identity a delusion, because you can't demonstrate whether it's true or false. The evidence for and against will be similarly circular and metaphysical as the evidence for and against other unverifiable convictions. You either believe, or you don't. We correctly accept that some people want to live their lives according to their beliefs about gender identity as long as they don't hurt anyone else, similarly to people who believe in other unprovable things like Jesus being the son of God. That's why I think comparing it to a religion is the best parallel. It also helps explain why those who don't "share the faith," as it were, get so offended by the thought of enshrining these quite niche beliefs about gender and sex into law.