“All things being equal” doesn’t mean the candidates are identical. You’re right in that is impossible and would never happen.
Rather, it means that I have two or more candidates whom I have full confidence would excel in the position. They may have different strengths and weaknesses, different intangibles, to use your word, but they are qualified for the position and in my view are likely to excel equally in the role.
In that instance I think it is perfectly appropriate for gender to be a deciding factor that tips the scales. In fact I would actually call it prudent business.