Why? As others have said, because everybody KNOWS you can’t really, actually change sex. Because everybody KNOWS that whatever you do with it ultimately, being born with a penis makes you more important than those born without one. It’s just there. Just a fact of life in patriarchal society.
Why is Queen Elizabeth’s husband Prince Phillip and not King Phillip? Because King trumps Queen. If a man is the hereditary monarch, his wife is automatically Queen, because as a queen her status is still lower than his = doesn’t threaten or lessen his. But if a woman is the hereditary monarch, her husband cannot be a king. His status would then be higher than hers, so it cannot be allowed.
Because all other things being equal, those born with a penis are more important, count for more, than those born with a vagina.
And even if Princess Charlotte had been born first, this rule would still have applied, so despite the apparent equality in succession now, the monarchy still embodies the values of patriarchy.
And obviously, status in the monarchy is going to personally affect even fewer of us than succession in the aristocracy(!) but this is one of those strands of misogyny that stands out when you look at it closely and see that absolute reality of male primacy woven into the fabric of our society; the unquestioning acceptance of it that permeates our culture through and through.