Obviously D&D evolved out of medieval miniatures wargaming (Chainmail). If we boil premodern land combat down to its most basic level, then I would argue that we find three fundamentally atomic types of hand-to-hand combatants (leaving out missile troops for the moment), which I'll call: Swords, Cavalry, and Pikes.
You'll see these three core types in the diagram above. The arrows indicate a relationship of "is dominated by", or "leads to a development of". In the broadest possible terms, you could track a history in which the ancient Greek phalanx (pikes) was superseded by the flexibility of Roman legionnaires (swords), which were ultimately replaced by medieval European cavalry, which was ultimately bested by Swiss pikes, which began losing battles to Spanish swordsmen in the 16th century, etc.
When I say "Swords" here, I'm ultimately thinking of any shield-and-something combination where you walk up to an opponent and swing a melee weapon in an arc with your arm in order to strike a blow (which could include swords, axes, flails, etc.) Cavalry are charging lancers. Pikes are any long, pointy weapon that you can stick out defensively. Perhaps you could think of this categorization as the "Rider/Pike/Sword" triad (i.e., RPS, so as to emphasize the analogy with rock/ paper/ scissors).
Consider the core D&D combat sequence of movement, followed by an attack (or some other permutation; the important thing is that they're discrete steps within a turn of action). Interestingly, each of the three core combat types interacts with the move/attack sequence in a different way.
Swords (or any handheld weapon that delivers a blow by stroke) work the most elegantly within this system, and they're also the type most emphasized by D&D itself. It does make sense that moving up to an opponent by leg power, and then standing and swinging a weapon with your arms several times, are indeed separate and distinct components of an action. It also makes sense that this type of action takes the spotlight in D&D, with its focus on close combat within the confines of a dungeon, where other longer weapon types are impractical.
As much as it pains me to say it, cavalry and pikes very intrinsically work counter to a separately phased move/attack sequence. The essence of a Cavalry attack is that it happens while in motion -- the horses gallop, the lances held straight ahead and still, the moment of impact, and if successful, the breaking of the enemy line and continuation of the gallop. The attack is fundamentally one with the attacker's motion. Pikes are the inverse of that; primarily the advantage is defensive, again with the pole weapon held out straight ahead and still, but set so as to take advantage of the enemy's movement, as the foe's momentum causes them to be impaled upon the presented points. In other words, the ideal attack is fundamentally one with the opposition's motion. In both of these cases, I would argue, the discrete move/attack sequence breaks down, because it is inherently antithetical to the nature of the attack; the impact is due solely to the forward momentum itself.
Cavalry and pikes, meanwhile, get surprisingly short shrift in the classic D&D rules. The three-page Chainmail section on man-to-man combat (p. 25-27) manages to contain more detail on mounted combat than the entirety of the OD&D and AD&D system, for example. Again, this is not entirely surprising, but notable nonetheless. If you do want to run games with prominent usage of classic cavalry and pike units, then you've got to make certain independent adjudications (filling gaps) about how they work. That's just the nature of the beast, because it wasn't part of D&D's core competency.
- Historically: Swords best Pikes best Cavalry best Swords.
- Sword attack is a separate impulse from movement.
- Cavalry attack is intrinsic to the unit's own movement.
- Pike attack is intrinsic to the unit's enemy's movement.
- Cavalry & pike are only cursorily treated in dungeon-centric D&D.