After all, the party will consider taking a long rest because they feel they're "running out of gas", that they don't want to go further down the dungeon without ability recharge.
Since they aren't pressing on anyhow, they will still have to endure those random encounters regardless. And since those encounters will in practice never actually interrupt the long rest (as in forcing you to start over) they're essentially purposeless (if the idea was to add a cost or consequence to the decision to rest; either by encouraging the heroes to proceed even at "low gas" or by forcing them to "return to town").
If anything, the presence of random encounters only make heroes stop their adventure day earlier, since they need to keep some gas in reserve for the inevitable random encounters during the 8 hours of their long rest.
Not saying there's something inherently wrong about this.
But as a commentary on "it's pretty much impossible to do a long rest unless you want to do several battles during that time". What's the alternative? If there are random encounters, there are random encounters. What 5E doesn't have, however, is random encounters that break your rest.
Zapp
PS. And all of this assumes what in practice never happens except at the very lowest levels - that the players don't trivially arrange for interruption-free rest. Many dungeons contain "safe" rooms. More generally, the rules are incredibly generous with magic that all but guarantees safe rest: Rope Trick and Leomund's Tiny Hut spring to mind (but there are plenty more spells that make avoiding random encounters trivial).
If you're acquainted with my views, you will recognize this as perhaps my biggest beef.
On one hand the rules set up challenges and make assumptions about encounters per day. But on the other hand the rules inexplicably hands out an abundance of features that allow players to short-circuit all of that and essentially break the entire game.