The base design of 4e is very good,.. The discrepancy between classes (e.g., Martial is fairly dominant, IMX)
That's an interesting & unique experience. As much better balanced - free of LFQW & so forth - as 4e was compared to other versions of D&D, it still disfavored the Martial source in a few small ways. Lack of the controller role, for a significant instance, and less versatility to be found among its exploits (maneuvers) and not much beyond skills (which were the main thrust of non-combat Skill Challenges, of course) out of combat, most tellingly, of course, compared to Rituals (which, at least were more limited than they are in 5e). This isn't the thread for it, but I'd be interested in the form this dominance you experienced took?
It's actually really easy to make a perfectly balanced game - just don't allow for character differentiation. But that wouldn't be fun.
What's the practical difference between 1) a game that's so incredibly imbalanced that there's only one viable character 'build' and everything else is so utterly & obviously inferior to it's the only thing anyone ever plays, and 2) your hypothetical 'perfectly balanced' game that has no character differentiation at all?
Balance is a challenge because it offers up many choices, as many of which as possible, are both meaningful and viable.
Balanced games aren't automatically fun, nor are fair games automatically balanced. But, for a hypothetical game that's fair, and offers a certain number of choices, it's pretty likely that the more of those choices are both meaningful (that feel like the choice says something differentiating about the character and makes some difference in how you might play it, say) and viable (consistently contribute to success in the, presumably cooperative, game to the same degree as the alternatives, if in a very different way), the more fun it'll be.
3.5 was a very imbalanced game, of course. It was bedeviled by LFQW distorting class balance, the 5MWD distorting both class & encounter balance, and it was
intentionally furnished with a mix of chaff, 'trap,' viable, and optimal choices that required significant system mastery to navigate. That said, while the conventional TTRPG of 3.5 D&D was badly balanced, the charop/level-up meta-game was engaging and, of course, fair, as was it's use as a PvP arena combat game.
The pendulum swung pretty far over on the side of balance in 4e, which was hopeless for PvP, and offered much lower rewards for system mastery in the charop/level-up meta-game (which could still be pretty engaging for build-to-concept), and did away with LFQW & reduced the impact of the 5MWD (even offered a couple of mechanisms contrary to it). That pendulum hasn't swung
all the way back with 5e, the 5MWD can be a major problem again, but the DM has more latitude to force the very long day at which overall DPR theoretically balances, and while LFQW is back, it's not exactly badder than ever.

5e, though, avoids balance not just by offering imbalanced options, but by simply offering fewer options, overall.