

From a philosophy standpoint - it is way more complicated than that.
Gender is sort of like a book genre. People made it up. It groups a bunch of ideas around physical sex that don’t really have anything to do with it directly. It’s sort of like stereotypes but it’s also an amalgamation of history and how people express. You can have a culture where gender has hard rules or soft ones. You can have a gender expectation what a culture rewards people of a specific sex for doing or punishes them for not doing. Gender expression where there is a way of culturally displaying gender to others based on a cultural idea of what those sexes represent and how people think they differ : clothes, the way you act and so on.
The thing is these things are all not set in stone. They are all just cultural baggage.
Sex is just the thing gender chooses as it’s centerpoint of creating all this fiction.

Yeah “gender” is actually a theory of deconstructing the idea of culture - all the stuff lopped on top of sex and the baggage of all the world’s ideas of what it means to be male and female from the pseudoscientific aspects of outmoded or outdated disproven science to the effect of religion to the behaviours mimicked and taught between generations.
Gender is cultural.
Yet “sex” is also on a spectrum.
What modern discourse gets rather fantastically wrong to my mind is for trans people it is about sex characteristics. A trans woman doesn’t just want to be treated as a woman she wants to be a woman. For a lot this means the whole shebang from periods to childbirth. That’s not gender, those are sex characteristics. Her issue is she can’t access those aspects yet or, like other women, maybe she doesn’t want nessisarily everything. She’s also set outside the culture of womanhood, segregated from other women and denied community of her people socially - that IS gender.