I think dogs can probably smell aggression, and if a dog is around aggressive people and then sees the hitting, he associates that with the aggression. So barking to hitting is a learned response. We can't forget that dog's noses are 1000 times more sensitive than humans, and even in humans, smells are powerful things that bring back a flood of memories. Nobody ever pretends to hit me, but Joey barks if someone yells at me.