The kid is playing and even at that age, perceptive enough to get it’s a game.
Also I think it probably is quite healthy to teach young children about their own potential for physical actions, including fighting.
Though I think you also need to teach kids that they can hurt others, and by experiencing that, not just the power of it, but the negative impact, that they may not really want. And also, very carefully and kindly, that they can be overpowered and hurt too.
I distinctly remember being quite young (4?) and “sword fighting” with my dad. I was a Peter Pan fan at that age, and I tried to do a swashbuckling maneuver of bounding from cushion to cushion on the couch . . . and it didn’t work. I was outmaneuvered and it was clear my dad could overpower me. I was a bit upset about that, and it smashed some of my enthusiasm for swordfighting for a bit . . . but I think that was good to experience, and at a young age.
I had a similar experience playing board games with my dad, including Chess and Tactics II (a tactical wargame), and again, experiencing defeat in combat was a bit crushing and discouraging, but I think valuable. It taught me that fighting and losing would be terrible (or even deadly) in real life, and about helplessness.
But it also made me interested in safety, defensiveness, and effective tactics and escape. And, by the time I was in Kindergarten, it had me defeat gangs of kids trying to “beat up” (young kid version) me and my friends, multiple times. It led to a general awareness and ability to assess and respond seriously to dangerous situations.
I noticed later that most kids through high school, even the best athletes, had little or no understanding of fighting, or how to respond effectively to danger, but I kinda did.