This issue will set Wither Skeletons as example.
Wither Skeleton's height is too short to reaching Camel's back. But when a Wither Skeleton and a Camel ridden by a Player are on the same parallel ground, Wither Skeleton is able to hurt the Player.
This may has sth to do with Wither Skeleton's attack range.
Other affected mobs:
Wither skeleton
Cave spider
Spider
Goat
Hogin
Zogin
Panda
Blaze
Slime(Size:1)
Magma cube(Size:1)
PS: Datapack on.
PPS: Words below: "(I was) hurt by Wither (Skeleton)!"
Maybe fixing MC-80877 would partly fix this problem?