The whole broad question of "when is it okay to hit back?" is greatly flawed. See, it doesn't matter who is on either side of the equation. Male, female, trans, intersex, young, old, body builder, scrawny twig, able bodied, in a wheelchair, whatever, I don't care what the attacker or victim's particular description is: if the victim feels endangered by the situation, they are totally in the right to strike back in order to stop the attacker. This concept is known as self defense. This hinges upon the defending party only striking back enough to stop the assault, by the way. If a big macho dude is getting the shit slapped out of him by a guy a third his size, a single punch ought to straighten things out. It's all about stopping the attacker, not about injuring them or getting revenge upon them. Stop the attacker, then remove yourself from the situation. Doesn't matter if you're a big guy getting slapped by a tiny woman, doesn't matter if you're a woman being punched by a guy, do whatever is necessary to protect yourself and you're in the right.
The only point at which gender or anything else ought to come into the question is when determining what the minimum required force to stop an attacker is. Women do not get a free pass to hit men just because they have a vagina. Trans and intersex people don't get a free pass because of their status. Various racial minorities don't get to slap white people around without repercussion just because they're a minority. There is no free pass here. If you attack someone, then self defense is invoked and they are 100% within their moral and legal rights to stop you with violence, end of story.