polearms were the primary weapon for many armies for a reason.
Mainly striking distance and price
add to that the fact that sword in inexperienced hands is only a danger to self, whereas almost everyone can use a pointy stick.
Swords take training, time, upkeep, and 3 times the amout of metal that most polearms/pikes have.
most polearms also started out as farming implements before they were later adopted and weaponized by the millitary. Take for instance, the billhook. Designed for cutting branches and taking care of orchards. used quite effectively by press-ganged farmers during war to kill mounted knights, pulling them from their horses.
the peasants knew how to handle their farming tools, and the majority of armies in the middle ages were serfs protecting their lords interests. It only makes sense that they designed the polearms in such a way that these people would have the greatest advantage with something that was more familiar in their hands