I'm working off a few assumptions here to help explain why Code Geass has mecha, why they roflstomp tanks so well, and why said mecha apparently have armor that gets shredded by mech-sized assault rifles.

1. Sakuradite allowed CG to develop magnetic coil guns a long time ago. While originally they were overly complicated and needed to be cranked by hand, they totally removed the need to develop shell casings and eventually they would develop to the point that they have much higher shell velocity than equivalent chemical explosive firearms. This also explains how Slash Harken are even a thing.

2. Sakuradite can store absurd amounts of electricity per unit mass, so you can have a relatively small capacitor power all of the crazy strong electric motors you would need to actuate the limbs of a mecha. Those motors also have Sakuradite components.

3. With coil guns so damn strong, attempts to develop any serious armor for vehicles virtually died before the end of the age of vacuum tubes. Tanks can't do any of the ridiculous maneuvers that Knightmares can do, and there's little point to using a weapon bigger than a 40mm gun for anti-vehicle roles. This reduces effective combat ranges greatly because of lower caliber rounds. Thus, the stability of the firing platform and the size of guns they can carry aren't actually advantages in their favor.

4. There are no nuclear weapons, because Sakuradite killed almost all interest in uranium or nuclear physics. Without nuclear deterrents, open war between major powers is still viable. This is similar to the situation in the world of Ace Combat. Strangereal has nuclear weapons, but they're extremely rare due to an anemic level of fissile material in the crust. This is why they have a major air superiority war almost every damn decade.

The lack of nukes or worthwhile armor combined with overpowered coil guns in Code Geass allows the romance of the Knightmare Frame to continue to match reality.

In short, Sakuradite is bullshit.

(С) Einsig, Sufficient Velocity