Another thing to keep in mind here is that rpgs are also role playing games. That doesn't take away from the optimization discussion which is all still valid, but there's more to a game's complexity (and also it's quality) than just build options. Building characters is basically a game upon itself, but actually playing the game has its own levels of complexity.

Everything that's been said about builds also applies to gameplay, but it's a bit more obscured, because in role playing games, like in life, the objectives aren't very clear and they usually differ from person to person. A game's resolution mechanic could be as simple as "Roll a d20, add your level, >10 is a success, < 10 is a failure". That's obviously not very complex. It doesn't really have any depth at all, but honestly if it's just a "beer and pretzles" game, it would be more fun than a few rules-lite systems I've played. Even adding attributes to rolls in addition to/instead of your level would increase a game's complexity, but also it's depth. Like, think about how you approach problems in rpgs, you try to play to your character's strengths (or show off their weaknesses for comedic effect). I would consider the barbarian deciding to intimidate the guard instead of sweet-talking him because it suits him better a very lite form of depth.

Also, think about lookup tables. Hardly any modern rpgs still use lookup tables (ie, roll 1d20, 3d6, 1d100, and look up the result on this table) in their main game play. They add a lot of complexity (having 100 possible results instead of 2, or 4 if you run with partial success/failure). But they don't really add much depth. Especially because the players rarely know what the content of the tables are before rolling.