You hit on a difficult problem. And I don't think it is just about gender or race but also personality. People who are full of themselves, demanding etc tend to get more than people who are humble, don't brag or exaggurate their skills. I have seen so many times how guys asserting stuff with absolute confidence which was even completel wrong, get further than those of us who try to qualify our answers. I think men in part benefits from having a larger fraction of inflated egos. I think many men as well would benefit if qualities more prevalent among women was valued higher.
I suspect it is not just that women get punished harder for acting more assertive. Look at Hillary. But men acting softer also seem punished. People like Andrew Yang who give balanced answer isn't appriciated. While macho assertative egomaniacs like Trump get a huge following.