Why should players get to choose how mechanically powerful their characters are, vis-a-vis the obstacle the GM frames them into?
In the fiction, a party might very well decide (rightly or wrongly) something like
Cleric (wise party member!): "Hey, we committed to taking out that dragon for the townsfolk but given what those two wyverns just did to us we're clearly not up to it right now. We either need more people, more skill, or more magic before we try that dragon, unless we all just wanna die to no purpose. What say we take on something a bit less challenging and use whatever loot we find to build up our anti-dragon resources?"
Rest of party, in summary: "Sounds good. Let's go knock off those Ogres we heard were causing trouble in the Althasian Hills."
End result: the party is probably overpowered by the time they meet the dragon.
However, the same party could also say:
Fighter (unwise party member!): "Phew! Those wyverns smacked us around real good. After that, a single dragon should be easy pickin's. Let's get after it before someone else does!"
Rest of party, in summary: "Yeah! Gear up! Let's go right now!"
End result: the party is probably underpowered when they meet the dragon.
In either case the players IMO have to be left to their own devices and allowed to make these choices, if it's what their characters would do, even if it runs either they or the DM's monsters into a hole.
I mean, there are approaches to RPGing that half-answer the question, but they also give the players significant authority to do their own framing. (I'm thinking mostly of Gygaxian dungeon-crawling, where the players get to choose both (i) which goals to pursue to earn XP, and (ii) which rooms/levels to tackle - ie they get to do a lot of their own framing.)
This principle expands beyond just room-to-room dungeon-crawling into having some choice over which adventures or missions - or dungeons! - to take on in the first place, and when and-or in what sequence.