The standard game mechanic that has existed since the dawn of (J)RPGs is that all enemies within given zones have a certain strength (which often varies randomly, but only within a relatively narrow range.) The first zone you start in has the weakest enemies, and they get progressively stronger as you advance in the game and get to new zones.
The idea is, of course, that as the player gains strength from battles (which is the core game mechanic of RPGs), it becomes easier and easier for the player to beat those enemies, and stronger enemies ahead will make the game challenging, as it requires the player to level up in order to be able to beat them. If you ever come back to a previous zone, the enemies there will still be as strong as they were last time, which usually means that they become easier and easier as the player becomes stronger.
This core mechanic, however, has a slight problem: It allows the player to over-level, which will cause the game to become too easy and there not being a meaningful challenge anymore. Nothing is stopping the player, if he so chooses, to spent a big chunk of time in one zone leveling up and gaining strength, after which most of the next zones become trivial because the strength of the enemies are not in par. This may be so even for the final boss of the game.
The final boss is supposed to be the ultimate challenge, the most difficult fight in the entire game. However, if because of the player being over-leveled the final boss becomes trivial, it can feel quite anti-climactic.
This is not just theoretical. It does happen. Two examples of where it has happened to me are Final Fantasy 6 and Bravely Default. At some point by the end parts of both games I got hooked into leveling up... after which the rest of the game until the end became really trivial and unchallenging. And a bit anti-climactic.
One possible solution to this problem that some games have tried is to have enemies level up with the player. This way they always remain challenging no matter how much the player levels up.
At first glance this might sound like a good idea, but it's not ideal either. The problem with this is that it removes the sense of accomplishment from the game; the sense of becoming stronger. It removes that reward of having fought lots of battles and getting stronger from them. There is no sense of achievement. Leveling up becomes pretty much inconsequential.
It's quite rewarding to fight some really tough enemies which are really hard to beat, and then much later and many levels stronger coming back and beating those same enemies very easily. It really gives a sense of having become stronger in the process. It gives a concrete feeling of accomplishment. Remove that, and it will feel futile and useless, like nothing has really been accomplished. The game may also become a bit boring because all enemies are essentially the same, and there is little variation.
One possibility would be if only enemies that the player has yet not encountered before would match the player's level (give or take a few notches), but after they have been encountered the first time in that particular zone they will remain that level for the rest of the game (in that zone). I don't know if this has been attempted in any existing game. It could be an idea worth trying.
All in all, it's not an easy problem to solve. There are always compromises and problems left with all attempted solutions.