I have found that you can be just as confident, as a woman. And that acting with confidence leads to people respecting you. I also don't fear walking at night, and I don't fear being the only woman in a group of men. I don't assume most men are out to get me either.
It is partly white privilege (although lots of white women are very insecure and feel deeply unsafe), but I don't think confidence is inherent to gender. I understand that for you it is an inherent part of yourself, just like your gender. And so it feels inherent to your masculinity, which is fair.
But as a woman, I have experienced many of the same things you have, in not being treated with sexism except very rarely, and not being mansplained to, not feeling unsafe around men etc. So I don't think it's just a male socialisation thing.