What would you advocate for in this situation? Only girls are allowed to defend themselves? neither can?
Teaching children that, while they should never start the violence, the use of proportional, controlled, violence to defend themselves is reasonable.
A girl should be taught that a boy (or girl) hitting them, can be responded to in kind, if they've not got another reasonable option. The reverse also applies. Up until puberty, the ability to fight is fairly symmetrical.
I suspect the hidden context is key.
Boys are often taught Never hit a girl. If they are then repeatedly attacked by a girl, then they can end up in a no win situation. Particularly at 4, this can be very black and white. That unacknowledged helplessness is a classic precursor to later bullying, and needs to be nipped in the bud.
The use of proportional violence is actually reasonable at times. A hard shove to get them clear, and so unable to hit you. Even just active blocking (hitting their limbs away). It doesn't matter the gender of those involved.
I'm an advocate of children (boys and girls) doing martial arts. It builds confidence and body control. It also teaches quick proportional defence. Those combine to both keep them safe, and let them protect others.