This behaviour has been in the game for ages. MANY years, maybe at the start of Minecraft even - it applies to like every mob in the game
A clarification - This is caused by
Mob block picking doesn’t get interrupted when hit
I think this actually happens because mobs pick a target block to go to, and don’t stop when interrupted.
When mobs pick a block to walk to, either attacking or panicking (random block), the mob doesn’t change the block it wants to walk to even if it is hit, and only changes after being hit far enough. This causes the mob to constantly ram into the player if the block the mob picked to go to is behind the player.
This can be tested easily by spawning any animal, then hitting far away BEFORE it reaches its chosen panic target block (most easily done with a sheep). The behaviour that will be displayed is that the mob will choose to run a straight line to the original block location after being hit very far from it.
This happens when the mob is wandering too.
extra info : This also applies to the ender dragon if you can hit it in fast enough succession lol
extra info : The “franticness” of the mob also affects this, which means villagers (probably the most frantic) will do this less often, because they go frantic and pick a random direction to run in a lot more when panicking.
Btw it only happens with some cases of flowing water
1.8 lol