Children learn how cruel and close-minded society can be at a very young age. Whether it's the media reinforcing gendered stereotypes, or loudly opinionated peers, even kids living in the most liberal areas quickly find out which interests and fashions are "for boys" and which are "for girls." Gender may be a construct, but it's one that's heavily enforced by everyone from toy and clothing manufacturers, to school teachers.
Kids are often subconsciously fed a fear-based narrative around doing anything that's not meant "for boys" or "for girls," and this goes double-fold for little boys expressing any connection with femininity. When you add a heaping dose of toxic masculinity and homophobia, these views become even more strongly etched into a kid's psyche.