In terms of how that affects biological sexual development and associated gender identity i can't say offhand and it would likely be a rabbit hole that one can spend hours looking into.
TL;DW: your understanding is a simplification. It an assumption that allows educators to move past complex nuances when teaching about broader topics as part of a general education. Chromosomes and gene expression are a chaotic mess in reality.
It's not really about the genotype. Every context that uses sex to divide people into groups has its own definition of sex. Sometimes with a spectrum sometimes not.
Example car crash testing: When testing safety features of cars, you're not gonna care about whether the person has a vagina or not, but features like height, neck strength and other stuff will matter.
Since women are on average smaller and less muscular than men, small people with weak necks will be categorized as female. Tall people with strong necks will be categorized as male.
Example Condoms:
Two categories: has penis (male, can use) and has no penis (not male, cannot use [for inteded purpose]). So if you are XY genotype, but without a penis (idk cut off?), you're not a male in that context.
As you see both examples correlate with the gonosomes, but are not defined by it.
Sex is about the testes & ovaries (I’m ignoring intersex rn). Think of getting a shot; the sex is the medicine inside the shot, the penis/vagina is just the syringe.
Even if you have gender affirming surgery, you’ll still be the sex you started out as. It cannot be changed, yet.
I did. It does not depend on context. Gender does.
Sex is like rooster & hen, there’s no ambiguity as to which is which. There’s no context in which we would refer to a rooster as a hen; hens lay eggs, roosters do not.
Likewise, there is no context in which we would refer to a male as female.
Also, and again: removal of genitalia does not change a being’s sex.