The switch is very weak hardware wise but also very reliable I feel. For being a handheld device they're surprisingly tough and cartridges do have a much better chance at longevity than disks so I'd say of all consoles I'd put Switch on the top for longevity and best odds of working well 20 years from now. Do note this is ONLY true of cartridge games. If you have Nintendo eShop games I don't expect them to work 20 years from now because that eShop might not be around and I'm confident it uses some form of phone home checkin to verify DRM. That is likely fixable but out of scope for this discussion.
As for Steam Deck / other handheld PCs the games are less likely survive 20 years, games have already started to disappear from Steam (unpopular ones) and I very much doubt every game I have today will be available/playable. Because Steam will be dropping support and not every game is DRM free in ways that mean you can run them once they're dropped from Steam. The PC handhelds also tend to work very poorly without Internet since Steam wants to phone home from time to time. As for the hardware I think the Steam Deck might last 20 years given it's Linux based. Stuff like the ROG Ally will be hard to make work due to the outdated Windows on it and the likelihood that you can't upgrade it and games/steam won't work without an upgrade.
So no ads, sure, but then you need a commandment about paying for what you consume. Since otherwise, if we all followed the commandments, we'd be out of content right quick since you can't make a living producing it.