While I could be mistaken here, I’m pretty sure the halberd family of polearms were specifically designed for infantry combat.
Most medieval polearms were basic infantry weapons. You could use them to deal with opposing infantry or cavalry depending on the situation. It was not, just, a counter to deal with cavalry. It was an easy to produce weapon you could afford to issue to all your soldiers, and was easy to drill them on.
There were polearms specifically adapted to deal with cavalry, the billhook is one such example. So far as it goes, the halberd was a weapon which could be used against cavalry. But, the basic design was intended for dealing with opposing infantry.