Gender is a concept that kids are just learning about at that age. I don’t read this as a “fix your problems by hitting girls” and I don’t think that’s the message that would be received. The received message, by a 4 year old, is “hitting people is ok” and that’s unacceptable.
Any self defence trainer will make it clear that it’s not acceptable to hit anyone who isn’t a threat or consenting.