In BG, IWD etc., you could rest anywhere as well, but you had a chance to be ambushed... just reload and rest again - done. Not a good system.
In NWN you can just sit down and rest in a corridor for 5 sec and you're good to go blasting meteor showers and horrid wiltings on them bandits in the next room.
It's only ToEE that punished resting in a wrong place really hard - you still could do it, but you would be ambushed 100%, unlike BG, where it was a coin flip. You absolutely had to get out of that maze of a temple, search for shortcuts and go rest in an inn. Gotta admit, the tension because of this was high. And it did not feel like a chore - you had to be careful, plan your resources and think about every spell slot - "is it worth to use now, or we can go without and save it for something more dangerous".
At the same time, Temple of Elemental Evil is a pinnacle of DnD dungeon crawling, so can't really compare BG3 to it.
Imagine now in BG3 there are no portals to move around and no fast travel and no possibility to just port to camp when you need to rest - you have to run to a hub for resting. Or use Larians pyramid to port back to a safe spot? Will the game be better? Don't think so.
It's our choice as a player to rest whenever we want - do it after every encounter or limit yourself to rest in a way that makes sense from RP perspective.