Almost every time when I try to punch a boar while on a horse all I do is walk up to the boar and start stuttering in front of it.
I believe that the model of the horse bumps into the model of the boar to create a wide enough gap so that you can't punch it since punching foxes and badgers works perfectly fine.
I also assume that the same thing happens when you try punching bears but I'm not brave enough to try it out.