For me the fundamental advantage of a spear or bayonet is that it keeps you a safe distance from any blows.
It Does?
A boar spear typically has a cross brace as part of the spear tip to prevent the boar, once he is skewered, from running up the shaft of the spear to get to the spearman.
An 18th century bayonet is designed for use as part of a formation of men, fighting other men..., not only are there folks on each side of you but also behind you (of if you're not in the front rank, in front of you). So a man on foot or horseback coming in cannot succeed in reaching you by swatting the bayonet to one side..., as all your chums are standing there with you and one of them will get him...
Solo, with a charging bear or lion..., if you don't get the tip into a vital spot on the fist try when the animal is in range, the natural reaction of the animal would be to swat what you are holding between you and it aside, and as it is charging in a split second it will be beyond a few inches beyond the tip of the bayonet, so you won't be able to reset yourself for a second thrust...,
IF you do get the tip into the animal, it will probably force you off your feet as the inertia and mass of the animal will force the musket and bayonet from your hands..., and the animal will still get to you...,
If you get lucky and strike an instant mortal blow..., the animal will probably die on top of you, and you will be struggling with getting the carcass of the dead creature off of you, perhaps before it smothers you. Male lions weigh from 350 - 550 pounds. Black bears can exceed 400 pounds, and bears in the brown bear family can weigh as much as 1500 lbs.
FYI when defending against horses, one grounds the butt of the musket... puts it upon the ground, and back in the day one probably prayed the a charging horse didn't actually hit the bayonets as the dudes closest were probably going to be squashed.
LD