On the other the "Because you want your character to fit your sense of how capable they should be and are willing to do the lifting to get that you're a bad roleplayer" isn't notably better.
Yeah absolutely.
This idea that optimized PCs and good roleplaying are somehow in opposition to each other is, frankly, not only pernicious and a little bit offensive, but demonstrably and obviously wrong a simple factual level, and even on a basic rational level! At best it's essentially a superstition that denigrates perhaps the majority of people playing TTRPGs. The cold, undeniable fact is that you can good at both, just like you can be a really fit, athletic person, and be really smart, much as some people desperately cling to "dumb jock"/"smart nerd" nonsense.
People can say "Oh well my experience is that..." but come on, that's so much hot air when you're asserting things about entire massive groups of people (again, probably the easy majority of people who play TTRPGs), especially things that are definitely not factual! It is really no better than assuming because someone is sporty/fit/healthy, they're an absolute dunce.
I'm not disagreeing, here, but I've come to the conclusion that often when people say something on the lines of "the players have optimized the fun out of the game" what they mean is that the players have solved a specific problem, or set of problems, and aren't interested in the same old solution/s. Once you've solved (or "solved") melee fighter, you're done with it.
I think that's part of the same issue, but a sort of narrower and more specific take, so I wouldn't use it that way myself without clarifying. As an example, I'd point to the way "optimized the fun out of" is typically used with online videogames, where it is part usually a specific singular solution that's "just better" than other ones (which seems to relate to what you're saying), and in part people getting bored of playing that solution out. Sometimes the solution is so inherently fun that even though there's a "best" way to build Class X in Game Y, then people keep enjoying that "best" way - but sometimes the solution is either drab/boring, or more commonly, tediously overcomplex and fiddly, and people just get terribly bored of it quite quickly*. It can also be very frustrating if the designers have kind of screwed up and not only there is there a clear "best" way to play a character, but that way is not in line with the "class fantasy". That's a relatively rare problem (especially in the last decade), and not quite the same thing as "optimizing the fun out of", but worth mentioning in this context I think. In the end, this is a problem you can generally solve via good game design.
(To be clear most of this applies only to online videogames, not really TTRPGs where you neither "win" nor "farm", so for the most part optimized the fun out of tends to relate to boring-to-play characters, not just "solved" ones)
* = EDIT: I can think of multiple (probably countless at this point, after 20 years!) times this has happened in WoW - i.e. the designers accidentally made one sub-spec of a class spec, like 20-50% more effective than other specs of that class. And like, 30% of the time, it's a really fun way to play and no-one but a few purists cares, but like 70% of the time it's either the most tedious two-button spam or most brain-melting 43 buttons needing to be pressed in a specific, continually-changing order, and if you mess even one up, your DPS is halved nonsense (hello Shadow Priests!).