It's really up to the DM to honestly decide what he hopes to accomplish with this rule of his.
If he wants to give the story illusion that you can't become more skilled until you "train" in a city... that's fine. But he also has to know that the party doesn't *have* to finish whatever dungeon they find themselves in. If the group gains enough XP to gain a level (or even 2) but won't gain those abilities until they train... the party could easily decide "You know... this next long rest of ours we're going to hike back to the city for our rest, but also to train."
It's then on him. Either he tries to stop you all from leaving the dungeon midway through, or he lets you go. He may find that you know what? Abandoning a dungeon midway through is just as story breaking as not training in a city to gain more abilities. So at the end of the day, perhaps he'll feel like the city training isn't really as necessary as he originally thought.
Or he still thinks it, and your party just has to suck it up and not level up for several sessions. It'll be one or the other.