My understanding, and I’m not a professional here, is that child development studies indicate that children develop a sense of gender identity by about age three. There’s a lot of debate about how this gets determined — whether it’s biological or cultural or both. This is, as you might imagine, very difficult to ethically experiment with. After this age it’s then also very difficult to
change that gender identity, such that it’s legitimately easier to treat a sex/gender mixup by helping the person involved adjust their gender presentation to match their internal sense of their gender.
You’d be free to argue that this isn’t an inherent property, I suppose, given initial probable-fluidity. But since it seems to settle into being a largely fixed part of your psyche before the point you’re likely to have permanent memories, I’m inclined to view that as a meaningless difference.
It’s at about the same level as arguing whether sexuality is an inherent property, I think? It’s another of those “it might be hardcoded or it might be early-development cultural, but it’s basically impossible to change it so…” things.