The thing is, the phalanx didn't fail because of the weapons employed, it failed because of the formation employed. Rough terrain and an inflexible command structure brought about the fall of the phalanx, not the gladius.
The phalanx failed exactly because of the weapons employed. You see, the phalanx relied on their pikes(or sarissas?) and it only worked in a tight and even formation, as soon as this formation was disrupted, be it due to uneven terrain or something else, it allowed for the attackers to close in and utilize their advantage in close combat and there was no way to turn the situation back. No amount of flexibility of the command structure could save the phalanx, because of the nature of it's core strength, and it all originated from their preferred weapon - the pike. Maybe if they were more prepared for the close combat with a sword, they could be saved, but we'll never know.
The only reasons the Romans (and similar forces of the day) got away with not using one is because they had particularly large, heavy shields and superb maneuvers which allowed them to control where fights would take place.
The romans' didn't "get away" with using the gladius, because their equipment wasn't chosen at random, it was picked precisely because it allowed for the flexible formations that their military machine was relying on. And the scutum was a part of it.
But it's not to say that the roman war machine didn't use spears at all. They did have triarii and almost every legionaire had a pilum or several, that, when pressed, could also be used as spears. Roman war machine was effective precisely because they tried to utilize every advantage they had.
Heavy armor was generally the purview of the upper class
Depends on the time period. Romans relied heavily on their armour, as often did the pike&shot formations of the Early Modern Period that are often depicted in 3/4 armour. But yeah, in Early Middle Ages and for the most part of the High Middle Ages the infantry wasn't exactly very armoured if at all. But then again, they didn't play as a big a role as before or later.
Dozens of texts cite warriors of the medieval period regarding being spearless as essentially being naked and at a large disadvantage
I did say that lack of both a spear or a sword would put a warrior at a disadvantage. I'm not saying here that the sword is OP, I'm just arguing that spear was not. It was a great weapon and had it's purpose, but that's it, no more, no less.
But that doesn't change the fact that the primary weapon of most every armed force that found any success was the good old infantry spear.
What is a primary weapon anyways? The one that you use first? And why does it even matter which one is primary if you're going to need both(or more) anyways? And most of all, how does this relate to being OP? Because OP usually means you don't need anything else, and it wasn't the case for spears.