Nintendo Switch and Nintendo 3DS cartridges use NAND flash for storage , not mask ROMs. Like all Flash memory, they "leak" charge over time and eventually lose data.
The Switch and 3DS card reader tells game cards to "refresh" themselves periodically. https://gbatemp.net/threads/nintendo-switch-3ds-cartridge-lifespan.591607/
But, some users are reporting cartridges already dying, especially ones they haven't used for years. I wonder which of mine already don't work.
Just a reminder that you don't own any data you can't back up. Buying physical cartridges and game cards isn't enough if they're using technology that inevitably deteriorates over time.