TheCosmicKid
Hero
You're absolutely right that this is a major worldbuilding concern in general and is not helped by the mechanics of many games, particularly MMOs. However, 5E's mechanics do actually provide something of a safety valve in the form of bounded accuracy: even an ancient dragon is not invincible and can potentially be brought down by a large unit of mundane archers. Sure, it's a crapshoot: a dragon can kill a lot of archers very quickly, so there's a good chance it wins anyway. But it's at least a plausible reason for dragons and similar threats to avoid direct attacks on large population centers without strong provocation.So you can have high level threats, but in general I think you cannot have those same high level threats on the prime material plane. Otherwise they'd logically have conquered the world already; after all, anything that requires level 18+ characters is usually invincible to normal humans and Orcs and whatnot.
(The tarrasque is notable because it actually is immune to nonmagical weapons. This, I think, is a large part of why the tarrasque is so dreaded.)