Would it be ok if we swapped gender with race, religion or any other protected class?
There's your answer.
There's your answer.
Even where the same justification applies, a distinction that survives intermediate scrutiny may not survive strict scrutiny.