When an entity spawns directly on the ground, the "OnGround" NBT tag isn't set to true for a brief moment. Consequently, entities like parrots and chickens briefly flap their wings upon spawning, and mobs that are immediately damaged after spawning won't experience vertical knockback. To test the knockback issue, you can utilize the command
execute as @p run damage @e[type=!minecraft:player,sort=nearest,limit=1] 1 minecraft:player_attack by @s
in a repeating command block, although it's possible to reproduce the issue without this command. This behavior is related to MC-190551.
steps to reproduce
Put the following command in an activated repeating command block:
Spawn a mob
Observed: The mob did not experience vertical knockback upon first being damaged due to {OnGround:0}.
Expected: The mob should also experience vertical knockback upon first being damaged.