A good place to start, OP, if you want to get to grips with this, is Alex Byrne's article, What is gender identity?
(Byrne is professor of philosophy at MIT. The article is fairly painstaking, if popular in tone, and covers most of your concerns with clarity and good sense.)
One of Byrne's conclusions: 'If there is some kind of “gender identity” that is universal in humans, and which causes dysphoria when mismatched with sex, it remains elusive. No one has yet found a way of detecting its presence ...
This takes care, if you like, of gender identity as a kind of scientific something-or-other; if there is no way of detecting something, generally scientists will agree (at least pro tem ) it does not exist.
There remain non-scientific reasons that can sometimes be adduced, as for things like immortal souls, say. Some people say they believe in immortal souls, others deny their existence; either way, the argument does not proceed scientifically, in the absence of 'a way of detecting' the soul's presence, to use Byrne's phrase. The existence of gender identity may be supported by similar such non-scientific reasoning.
Such latter reasons are often called metaphysical , for historical reasons to do with Aristotle's writings. What should our atitude be to such metaphysics ? Generally, at least in contemporary politics and its ramifications, metaphysics is held not to be a useful way of deciding important questions of law or social policy.
Is there such a thing as gender identity, then? No , not if we are asking in scientific mode. Possibly , if we are discussing in metaphysical terms ... but in this latter case, the answer is anyway unimportant as regards policy and the law.
Of course we as a society make plenty of room for people who believe in immortal souls, as we should. We ought to think of those who believe in gender identity similarly, of course, no matter what our own metaphysical beliefs (or lack thereof). But and this is very important we should no more allow gender-identity-believers to dictate our beliefs or policies than we should allow immortal-soul-believers to do so.