It's not about quality but rather a different business model, although quality is definetly a factor otherwise they wouldn't be able to sustain their strategy.
The difference to me is that most large game companies act more like technology compianies: they go though continuous cycles of incremental improvements. For each new game they tipically upgrade their production values, improve the engine, improve graphics, improve the netcode, add new features, etc. etc. also they create new settings and a new narrative to highlight those features.
So in the end the main value they're selling to customers is novely: new story, new features, new online communities, better graphics etc. The thing is novelty tends to wear off quickly, this is why most AAA games lose value over time. Plus, it's in the publisher's own interest to depreciate the game over time, because the next year they have a new novelty to sell and it has to be clear for the market that the previous game has become outdated.
It's not a coincidence Rockstar doesn't depreciate its games as quickly. There is certainly a question of quality, but also they don't want their games to become outdated before their next title is ready and they have long development cycles.
As for Nintendo, they act more like a toy company: they don't aim to create a novelty or a cutting-edge product, but rather they aim to create and sell a unique playstyle. Take 3D Mario as an example. Mario 64 was disruptive, after that they didn't a create a newer, improved version of M64 but rather they made Sunshine: a game with a unique theme (tropical) and a unique playstyle (fludd/water mechanics). Later they made another game with a unique theme (space) and a unique playstyle (gravity), and so on Mario Odyssey is another game with a unique theme (travelling) and a unique playstyle (morphing). This way, every time a new game in a series is released, the previous one doesn't become outdated. Even if it was released in 2002, to this date there is not another game in the market like Mario Sunshine, with its specific playstyle.
This is the reason why Nintendo games keep their value over time, the same reason why they can afford to update a gameboy game form 1993 and sell it for 60$.