The biggest problem with mecha is that for them to be effective weapon systems, a ridiculous amount of handwaving has to go into it. They are really overly complicated walking billboards begging to be hit by cruise missiles or crushed under the combined weight of 'inferior' but numerically superior tanks and armored vehicles.
I have had a thought. This thread isn't to explain why mechs are horrible weapon systems, but to explain a world where the mech is the main weapon system because of environmental and socioeconomic reasons.
1. The Resource Wars: the era of the resource wars was primarily focused on the decline of petroleum production. But this was only the most visible issue. Rare earth metals, strategic metals and volatiles were also the subject of operations. This ranged from the mundane, iron production mines and refineries to the exotic, rare earth magnet production facilities.
2. The Second Dark Age: the 2DA created a prolonged period of scarcity. Not the artificial scarcity of the petroleum age, but true shortages and scarcity. After several generations of this Have Little environment, materialism became a stigma. Capitalism becomes a minor aspect of most of the world, with localized communism and socialism taking over. Bigger is not better, bigger becomes synonymous with the mindset that created the RW and 2DA. Efficiency, pragmatism and frugality are the new measures of the world prior to the Second Renaissance.
3. The Second Renaissance created only a massive surplus of electricity. It did not blow the doors off of material resources or population levels. It also didn't throw the world into a debauchery of indulgence rivaling the Petroleum Era.
4. Tanks figured prominently in the Resource Wars, especially massive tanks like the M1A1 and it's offspring. The massive track and turret tank has become a symbol of the Petroleum Age, and carries implications and social values beyond it's effectiveness as a fighting machine. Let's Built Tanks should have the same sort of identification as We Should Guillotine Criminals and Dissidents. Nations that decide to produce tanks are seen as rogue states, or reckless and purveyors of WMDs.
5. Power Suits: Power Armor and Battle Suits required much less materials to construct, and growing out of civilian purposes and going into police, paramilitary, and full military operations. The armor suit is a prevalent feature of the Cosmic Era, from the poster image of the power armor trooper protecting the farm family from raiders to the bright red firefighter hardsuit putting out the flames.
So we have a milieu where the Tank is a symbol of waste and destruction, and not the good sort of destruction you want associated with a weapon systems. Did the tank really crush the productivity and creativity of the Petroleum Era under it's iron tread? No. But that is the common thought, making the tank an offensive object. The Power Armor system has a much more positive light, and unlike the main battle tank, lacking a public or socially beneficial use, power armor is as often associated with first responders, emergency relief, and rescue operations as it is as a tool of war.
The escalation of conflict going into the Second Renaissance created a demand for a heavier combat system than the power armor trooper. The economic and efficient answer would be to start building tanks again, but the tank is 50-70 tons of metal which is 100-140 power armor suits and offensive to the public opinion (Tienanmen Square!) So bigger power armors are built. The medium and heavy power armors are fielded, and carry more armor and heavier weapons than power armor but doing so lose mobility. There is simply a limit to how much metal a human suit operator can handle. The first mechs are fielded, and are effectively superheavy power armors with a pilot instead of a grunt inside it. These protomechs were 5-15 tons each and supported power armor suits in combat.
The mecha started getting larger and larger. The military industrial complexes worked to distance the mech away from the Tank. It has a pilot, not a crew. It has a humanoid layout, and a few have a dinosaur/avian appearance with digiplant feet and reverse knees. The new mecha are treated in a fashion similar to helicopter gunships, or ground attack aircraft.
Most mecha deployed stay within the medium range, between 30 and 50 tons. There are larger mecha but after a certain weight and appearance is reached, the veil of the mech as not a tank with legs gets stretched thin and these heavy mechs do not enjoy popular public opinion.
So tanks are relegated to the historical position of mustard gas in WWI, unrestricted city bombing in WWII, Atomics in the Arab-Israeli Resource Wars, and so forth. Are they solid and reliable weapons, yes. But chemical weapons work very well, as does the flattening of entire cities, and incendiary raids, and few weapons are as effective as thermonuclear weapons. But in the Cosmic Era these things are considered grisly reminders or an ugly brutal past.