There's some competing schools of thought on this topic, while I'll illustrate using a pretty well-known example: Fire Emblem 4 (Genealogy of the Holy War). FE4 is famously very easy (Thracia 776 was basically exclusively targeted at emblemiers who felt FE4 was far too easy), but part of the reason for this is that the second half of the game had to be winnable even with the quite terrible replacement units for if you failed to pair characters up or got them killed. However, between the common choice to reset a map if you lose a unit, and the wealth of knowledge we now have about relationships and hidden secrets, it's absolutely trivially to conduct a eugenics program and curbstomp the back half of the game (and this was true even when the game was new, since this is why Thracia was made to challenge emblemiers).
One argument is that if the game is well-made, you should be able to use any composition of characters (party members, Pokemon, cards in a deck, whatever) and still beat the game.
Another is that in that case, the game is devoid of challenge because it doesn't require you to make good decisions about your gameplay in order to win.
The counterpoint to
that is that if a game offers you choices but only a portion of them are realistic as options, then there is only an illusion of choice, because the only reason to make a non-optimal choice is to hamstring yourself on purpose.
However, if you don't need to make optimal or even good choices to complete a game, then there's very little challenge involved, which will mean some people will find it boring. Difficulty settings are one way of dealing with this, and these tend to work best in games that have a mathematical foundation, where optimization becomes objective, and tend to work less well in games that want to rely on the player's mechanical skill with the controller, as those tend to equate difficulty with instant death. I won't write an essay about it here since this is already a big post but this is one of the main issues with Souls games; most of the difficulty relies on hiding information from the player and simply stat-checking you, which heavily diminishes the impact on mechanical skill in a casual playthrough - the game is predominantly about
knowledge, and the game's artificial scarcity and decision to not communicate to the player effectively is designed to force the player to unknowingly make suboptimal choices about their playstyle, which snowballs the game's difficulty out of proportion. (This is also why Sekiro, which doesn't have character-building RPG elements, is so incredibly easy.)
Balancing these three things, or simply choosing not to, is a really important part of designing a game that allows the player to construct their own party, team, deck, weapon, and so on. Final Fantasy V does this fairly well, especially in remake versions which fix several bugs that killed certain classes, and by choosing to include new fights that are designed so that traditional overpowered strats don't work well on them (e.g. the new superbosses in the GBA version both have invisible dummy targets that soak up !Rapidfire attacks, forcing you to come up with a new strategy). However, this only works if there is a limited opportunity cost to changing strategies, which is why this works well in FF5 (where AP is abundant and equipment is readily-found) and works very poorly in Elden Ring (where you can only respec a limited number of times per playthrough and most of the information about equipment is hidden from you).
Speaking of FF5, something interesting about it is that while there is a canonical casual method of getting through the game (that being getting a Mime and doing Dual-Wield, !Spellblade, !Rapidfire), this method is much too slow for something like a speedrun, which often use significantly more of the game's repertoire in order to beat the game quickly and consistently - using Samurai for !GilToss, Chemist's !Mix ability to its full and gamebreaking extent, using Blue Magic along with some seemingly useless spells, using the poison flowers at Drake Mountain to set up a complete physical lockdown on Garula with a Knight, and so on.
I don't actually think there's a good answer to this concept because it's really going to vary
by player as to what they want out of a game. For example, I don't enjoy the original X-COM because I'm not a huge fan of the amount of logistical overhead, but there are people who absolutely eat that up and despise the more streamlined newer games. Some games award the player for playing for a
different metric than just completion, like Devil May Cry (the good ones) or Final Fantasy XVI: it's very trivial to beat those games by mashing the attack button, but the game gives you a large toolbox to play with and rewards you for doing so (with the Style Meter in DMC - which has gameplay benefits and manages the dynamic music in DMC5 - and score bonuses in FF16, which are used in several of its non-story modes). Therefore, the optimal choices for a given scenario can vary depending on your goals for the scenario, and either or both of those could be said to be correct.
Then you get into the ever-popular topic of challenge runs: "How to beat X with/out Y", for example. In these cases, much of the difficulty is 'unintended difficulty' because there is an assumption that you wouldn't do something like this and so the game isn't designed around it. ymfah's
Elden Ring Without Talking is a good example; the game absolutely loses its shit if you don't talk to anyone and it requires a lot of screwing around, but this isn't something the game was ever designed for, so there is an argument to exclude this kind of thing from consideration. However, this has the potential to become a slippery slope: at what point do you stop excluding non-optimal choices about how you play your game from consideration?
tl;dr complicated