One doesn't need to have some concept of the reality of gender to have sex dysphoria existing
Right exactly! That's what I'm trying to say.
A common mistake is to assume that, in order to experience dysphoria, someone must first adopt a particular theory of gender, but that isn't the case at all. A person can experience dysphoria regarding of their theories about gender and sex. Young children often experience dysphoria before they have any sophisticated ideas about gender identity, gender roles, or philosophy. The distress appears as an immediate, embodied sense that something is wrong about their sexed body or being treated as a member of that sex category. It isn’t reasoned into existence.
Where I think your argument becomes confused is in two ways.
First, you move from “the brain generates the experience” to “the brain is getting reality wrong.” Those aren’t the same thing. People often misunderstand trans people as being "deluded" about their bodies, but that isn’t generally what’s being described. Trans people are not under the illusion that they have different sexual anatomy. They know what their bodies are. The distress isn’t caused by a false belief about their anatomy; it’s caused by the fact that their anatomy is experienced as profoundly wrong or incongruent.
More fundamentally, contending that gender isn't "real" highlights another misunderstanding. No one is suggesting that gender is an independent object in the world. Gender identity is simply the language given to describe a psychological experience.
While gender identity itself isn't a "thing" the psychological experience of it is real. This is true of any psychological experience. Pain isn’t an independently existing entity. Hunger isn’t. Our sense of body ownership isn’t. They’re subjective experiences generated by the brain, but they’re nonetheless real features of human experience.