Firstly, I think there's a cultural component. In many places around the world, girls are aborted, because boys are valued more highly. I think a lot of it is to do with daft gender stereotypes in the West. People want girls they can do girly things with, and who they can treat like a little doll and dress in pretty clothes. A lot of men want boys so they can take him to the footy and all that jazz. In reality, genetics have nothing to do with the interests of your child. You might have a boy who likes to play dress up and would rather host a teddy tea party. You might have a girl who likes to run around and play in the mud. I know I was certainly a tom boy growing up, and was much more interested in Pokémon and making mud pies than I ever was make up! As an adult, I can't think of anything worse than having to go shopping with my mum. I'd rather go for dinner then get back to my nerd hobbies like playing DnD or PS5 :D
And then there's the perception that as soon as boys become adults and get married, they don't bother with family anymore and stick to their spouse's family. In those scenarios, why not look at your own behaviour and consider why your child and his spouse doesn't like coming over? You hear as much about interfering mother in laws as you do detached sons.
It's okay to have a preference. It's not okay to be a dick about it. I'm an intersectional feminist and believe me have plenty of rants about patriarchy, but if you're worried about things like make violence etc, then why on earth would you want your impressionable young sons to grow up reading that a lot of women did not want them, and hearing about how much it sucks to have boys? Surely that creates a self-fulfilling prophecy, and a bunch of men who WILL hate women? I'd be devastated for my child if I had a boy and he heard those things. Instead, try your best to raise your son away from toxic masculinity and to become a respectful adult.
Imo it's ridiculous to be having a child if you don't think you can unconditionally love either sex without forcing silly stereotypes on them.
I'm currently 17+2 with a baby girl. I'm same-sex, so me and my wife had a slight preference for a girl, just because we think we'd find it easier to raise a child the same sex as us in terms of being able to talk to them about their bodies etc. But I 100% would have loved a little boy just as much. In some ways, I feel a lot of pressure to raise a girl, because it's frankly a terrifying world out there at times for women, and it feels like a hard job to keep her safe. I'm also terrified of things like the impact of diet culture and gender stereotyping on her, because those things start pretty much immediately! Raising boys have their own challenges too.
Just love your LO for who they are, not what is in their pants.