The main thing is what the focus of the particular game is about.

There are games that put more of the focus on that realism and survival, whereby a large portion of the gameplay is about ensuring that your characters are healthy and are able to rest adequately.

In these sorts of games, resting can be a perfectly fine mechanic. You spend some time each day ensuring you have the resources required to rest and you will rest as and when it is needed (I.e. During evenings when characters are getting fatigued and hungry)

The issue is that for a lot of D&D campaigns (Especially video game ones), this isn't the focus of the game. They are instead more focused on spamming combats and NPC dialogues, the whole idea of "Travelling" and "Survival" is not even a secondary concern, it's all about building smooth-talking warriors.

As such, you end up with the sorts of things like BG3, where resting is a non-consideration and just something you do to recover limited resources. The game just wants you to fight and/or talk to things and nothing more. (This is also incorporated into the world design. Everything is squished down into a very small area because the idea is that you come across combats/dialogue much faster that way)

There are some games where they are a mix of the two, whereby they have some limited "Survival" mechanics (Such as Wartales or earlier D&D editions where ALL characters develop fatigue/exhaustion over time) which promote a general gameflow with regular rests but with the main focus being more on the whole "Combat/Dialogue" stuff.

But at the end of the day, it really is all about what the game is designed around.

There are places where resting as a mechanic can make sense and is incorporated very nicely into the overall game systems. But there are also places where resting as a mechanic makes no sense and just exists for arbitrary reasons.

D&D can be both. Given that it's merely a platform for DM's to craft their own stories (It's "Rules" aren't really "Rules" but more an example of a system that can be used. DM's and players can, and often do, homebrew their own rules to use in lieu of the handbook rulesets). Someone can craft a campaign that focuses more on the nature of surviving as a traveller/sellsword/hero in the making making more use of skills like Survival, Climbing, Swimming, Animal Handling and the like. Or someone can craft a campaign that focuses more on combat, where it's all about throwing the party into fights and getting loot.

As far as Divinity goes, it's been more in that "Combat focused" design rather than the idea of survival. With even "Recovering resources" from rests being a rather minor aspect of the games with very few instances of limited resources (And alternate means to recover them i.e. Eating people's soul)