Sigh. There are issues that people tend to forget about Long Rests: you can only do one every 24 hours, and the world doesn't stop because the players take a rest. Most adventuring days are going to be FAR less than the standard 8 hours, and that's not taking into consideration the 8 hours of downtime before the rest begins. If you adventure for a few hours then stop to rest in a hostile location, no matter what measures you take there will be consequences. Even if you retreat back to town/safety, the enemy should be adjusting their tactics and defenses against the party. There is a balancing point between when low resources are more dangerous than allowing the enemy time to regroup.
I experienced a horrible experience based on this in our current campaign. We were invading a beholder's lair in Avernus, having defeating a majority of the defenders in about 7 encounters, we used Leomand's Tiny Hut in what we thought was a secure part of the lair (outside would have been bad too, due to Avernus). We got a long rest and felt great... until after Leomund's Tiny Hut ended and the monsters came out of hiding. About half of the remaining defenders attacked us from two directions, while the beholder used a hidden peephole to hit us with the anti-magic beam. It was rough, with the casters having to get into melee to be able to cast anything, and even then only affecting half the battle (cut off by the beam). In the end we were worse off than we were when we took the rest, and the beholder still remained with minions. If we'd faced those minions in their normal locations without taking the long rest, rather than in the prepared ambush, we would have had more resources for the final battle. We manged to win, but Revivify had to be used (with only 2 rounds left!), along with every useful scroll and healing potion we had.