That's why you shouldn't judge by gender, but by performance of the candidate. That just proves my point. If your goal is a better future and you make performance-based decisions, you will minimize biases like sexism all by itself because what is less discriminating than assessing raw performance?
Not only that - affirmative action is disrespectful. Women can do as well as men. I believe in it. But that is precisely why affirmative action is obsolete. Only those who think women cannot handle the work and cannot perform on par with men favour affirmative actions based on gender. In the German language, there's already a word for women who were promoted into positions they cannot handle because there are certain quotas to fill as required by law. This is called "Quotenfrau" and is incredibly derogatory.
There are flaws in affirmative action, but doing nothing about disparities that have self-perpetuating attributes is a pretty bad plan by itself. Top candidates don't appear out of a vacuum.
And it's valid to consider the externalities when you're making a political choice. The goal is a better future, after all, not maximizing fairness in the short-term.
Still, it's a relatively minor factor with the way the current race has turned out. So we don't need to worry about those arguments.