Example: the PCs decide to hunt a dragon... the 1st 2 encounters they have is with his forces (kobolds, undead, death knights.... depends on the scope/level of the game) and they fall back and rest and reprep... the dragon can only then re recuirt or raise or what ever soldiers... as long as the PCs win the hit and run tactics are taking resources from the defenders of the dragon, and the PCs are gettting theres back.
Counter-example:
The next time the PCs show up, the dragon is waiting in ambush along with whatever forces it has remaining and crushes the unprepared PCs who didn't think they would encounter the dragon until later.
OR
The dragon goes hunting the PCs and attacks when they are resting, breathing on their entire camp before they can do anything. Since they are sleeping, the automatically fail DEX saves and take full damage.
Allowing PCs do repeatedly do hit-and-run tactics is pretty bad on the opponent's part. Once, maybe twice, sure, but after that the PCs should become the hunted, not the hunters.
Example 2: The local orcs go on the war path... they have sacked 3 cities so far and show no sighns of stopping. So PCs hit the orc camp and fall back, then hit the orc camp and fall back... 4th city falls, they hit the orc camp and fall back then the orcs attack them well resting they kill a bunch of orcs then rest... then a 5th city falls... as long as the PCs are winning those fights (sometimes winning being kill more orcs then can be recruited to fill ranks, and get out alive) they can keep going. the 'punishment' of more cities falling can be written off as "Yeah, and if we go die fighting them before the 4th city fell there would be no one here trying to stop them form the 6th 7th and 8th"
Counter-example:
After repeatedly being hit by the PCs the orcs trail the PCs to where they are resting, and sack that city--including the PCs.
Again, allowing hit-and-run tactics over and over just sets up the players to think it should always work--when it is poor tactics to allow it to IME.
example 3: god I hate that I was a PC for this... the DM has a sect of evil wizards (I think it was 7 of them I may be misremembering) each had there own forces (one had undead, one had summoned creatures, one had mercenaries, one had 'loyal' kobolds) and thought he would shame us into facing them one after another (it was a pretty high level campaign by this point). we would engage and separate 1 then do what we could, then plane shift out... hit and run wearing them down (even more then once pulling teleport in drop big spells teleport out trick)
it didn't matter that THEY were regrouping because we picked almost every battle field... and when they tried to pick one we would just leave and pick a better time/place.
Again, hit-and-run and allowing the players to pick the battlefield? Why? I would hope 7 high-level Wizards (INT was their highest scores, right?) would be smarter than that. Why would they never gang up against you? I could see maybe a progression like you take out 1, then a second, and now the remaining have a couple gang up against you, and if you defeat those 2, the last 3 form treaty to destroy the PCs as a united front.
Frankly, this smacks too much of the DM allowing the players to steamroll over monsters and not having the monsters react. How would the PCs react if they were the targets instead?
I'm sure there is a lot more to these scenarios, but from what you have said I can think of a lot of ways of stopping PCs from being able to get in the rests required to keep allowing such tactics to work.
Having said that, I want to emphasize that stopping rests only works (for ME) if the narrative of the story also supports it. If it doesn't then something else will happen. Take the hunting the dragon example. If the PCs destroy the dragon's minions, and the dragon has nothing left to help it take on the PCs, I would certainly consider just having the dragon flee (with his treasure

). Another option is (depending on the dragon type) having the dragon trail the PCs to their base camp, wait for them to
leave, and then burrow beneath it, creating a pitfall, and waiting in ambush for their return...
So many options, really.