But in 1e and 2e, NPC soldiers were either fighters or level 0 commoners (and thus mechanically equal to the pig farmer).
Not quite.
In First Edition AD&D a 0-level mercenary soldier in has 4-7 hit points (
Dungeon Master's Guide, page 30), while a commoner or bandit only has 1-6 hit points (
Monster Manual, page 66-69).
So, a rank-and-file soldier in 1E AD&D has got significantly more "staying power" than a peasant. They both use the 0-level attack table, but the soldier can usually take a single blow from a club, arrow, or spear and keep on fighting.
In Second Edition, human mercenaries have 2-8 hit points, and both soldiers and commoners have 1-6 hit points (
Monstrous Manual, page 196). They all have the same poor attack value (THAC0 20) but the trained warriors have Steady (10-12) morale, one better than the Average (8-10) morale of an ordinary human.
So, in 2E the difference is negligible - assuming that a peasant or merchant can wear armour like a soldier can. As there's no weapon & armour proficiencies listed for 2E peasants that's not necessarily a given.
This reminds me. There's a hilarious typo in the 2E
Monstrous Compendium Volume One ('Men' entry) which lists human soldiers
as having 1 hp each.
At least, I assume it's a typo. Either that or the evil overlords would be better off deploying legions of house cats...