It's quite sad to speak about RPG and read "optimal build" in it. This is a "disease" at this point as RPGs shouldn't focus on combat so heavily to the point there shouldn't be optimal way to build characters. Pathfinder games don't escape from that and of course you can find the optimal build for each class, and even find optimal multiclassing, just by reading before even playing the game, no need to go on internet. You can even foresee which will be the best synergies between characters through that and therefore know what kind of companion you'll favor over others. Pathfinder games are just tedious to read, but that's it, its ruleset is easy to catch for those who know already DnD or Pathfinder.
BG3 escaped that trap as any build is viable even in honor mode, and focused on roleplay more than anything. Its main issue was to feature too much useless fighting against extremely weak opponents (and AI choices but that's a different issue), which made the game too long and broke story immersion (it's not new though, it's been decades the problem exists).

To me, the best player agency possible was delivered by ZA/UM with Disco Elysium. Now we were closer to a visual novel/book we are the hero kind of RPG than a RPG campaign featuring meaningful fighting for fighting lovers or even a DnD/Pathfinder campaign (that don't feature that much fighting).

TB/RtwP RPGs should get out of this repetition of fights that suit ARPGs a lot better. It's no wonder the public has hard time with those to the point they're still kind of niche, especially the RTwP genre while BG3 and COE33 gave TB a bit of fresh air (mainly by copying what works with big studios, a great cinematography with good acting and good OST).