“Being infertile doesn’t change your gender.” True!
The rest of this piece? Not so much.
Consider the chicken. Female chickens have one active ovary and one dormant gonad that may be an ovary or a testis (or even both at once, known as an ovotestis). If something shuts down the active ovary the dormant gonad can activate to take over, which (if it’s a testis)causes a hen to begin transitioning to a rooster. Such roosters-born-as-chickens are (usually) infertile, but they rapidly grow to look like a rooster rather than a hen and engage in rooster behavior rather than hen behavior. As a biologist would put it, their sex (the original perceived status as male or female at birth) has not changed, but their gender (the appearance and behaviors typically associated with sex) certainly has.
As for humans, all humans begin development as females and differentiate during fetal development. (This is why men have nipples — nipples develop before sexual differentiation.) The process is amazingly complex and still not fully understood, involving a whole cocktail of developmental chemicals and genetically-coded responses to those chemicals, and it doesn’t always result in a simple binary outcome. Conditions such as androgen insensitivity and adrenal hyperplasia can lead to results almost as dramatic as the transgendered chickens above, and there’s a lot of evidence to suggest that the process can also result in much less obvious permutations and combinations of sex and gender. As such, it’s biologically useful to acknowledge that, for humans as well as for chickens (and for many, many, other species — don’t get me started on clownfish!) sex and gender are not the same thing, and treating them as immutable is not how biology works. No matter how much someone might have invested in saying otherwise.