Noteveryone has time to actually play through an entire game or work through it. Wouldn't video games sell more if they provide an option for the casual gamer - aka unlock everything, so someone doesn't have to work their way through it?
Nowadays it's more conventional to treat these assists as accessibility settings, clearly listed in the game's menus, advertised in its promotional materials/website, and covered in accessibility reviews, rather than secret codes that need to be discovered.
That way, players who are interested in the game but don't have the time, physical, or mental capacity to play the entire game on its default settings can more easily learn if there's a way to play it that will work for them, before they buy, and without needing to get secret insider knowledge from other players.
Game studios do this not just out of the goodness of their hearts or because it's the right thing to do to make technology accessible (though those should be reasons enough). It also increases the size of the market they can sell to, because as you point out, if a player doesn't have confidence they'll be able to play and enjoy the game, they don't buy it.
But the common element is that you either cannot die, or it's at least vastly less common for that to happen (eg. way more health/damage reduction, or super-fast regen), and the penalties for death are reduced to practically nothing.
These modes or related settings may also power up your abilities so you can more easily defeat enemies, overcome obstacles, or have less need to manage limited resources like ammo/mana/money/super meters.
Some games go even further and include some amount of auto-playing feature so you can "give your sibling the controller" digitally and watch it play past a part that's giving you trouble or that you're just not enjoying. Nintendo in particular has been exploring this, starting with the Super Guide in New Super Mario Bros Wii and continuing into, Mario Kart 8 Deluxe, etc. This has the added improvement over watching YouTube walkthroughs where at any point you can take back control to play the parts that work and are enjoyable for you.
So, the tradition of god mode and infinite ammo codes didn't completely go away, it's just changed form into one intended to be more discoverable, to serve exactly the kind of player need you've identified.
God modes were originally more of a developer mode, which would, by some slip of the tongue or through enterprising gameplay, escape to the end player. (Think of the Konami code for a famous example.) They come with ups and downs, but the tradition still somewhat exists.
The biggest drawback is with multiplayer games, particularly (but not exclusively) in cases of Player vs. Player; great investments have gone into preventing God codes / cheat-codes in these, not because they might make it more fun (or sometimes less fun) for one player but because they can ruin the experience for someone else.
That said, offline games typically have a flag which will enable a developer console, if you need one; and this, in turn, allows for spawning in ammunition, items, or NPCs, toggling invulnerability, or toggling clipping. It's usually locked behind a launch option, which is typically fairly easy to find on the web.
The other common option is to have a separate program running with shared memory, which can enable cheats independently from the game. This is common with games like Metro Exodus. In this instance, it's usually possible to find such a tool available on the web, but I strong advise against running anything you aren't absolutely sure of the authenticity of. Again, it serves the purpose of making the game more readily testable, and easing things for players who just don't have the time to get really good at it. However, anti-cheat programs will identify such programs very quickly when online.
The last thing to consider is the onset of the age of modding, in which many developers have gotten increasingly open to user-generated content for their games. This often includes mods which make the game significantly easier, or even game-breakers; but if there's no online competition involved, that's usually a safe assumption.
When publishing games on console, all game content, modes and options have to be listed as part of the submission and are subjected to (what these days seems to be theoretical) testing by the console manufacturers prior to release.
If a developer has added some semi-hidden cheat option, the functionality that is offered still has to be tested. If a bug is found that only happens when the cheat is running, this can delay the launch of the game. Why risk delaying launch by leaving code that was really only written to aid development?
Most code is developed under environments where there are "build configurations" that allow certain routines only to be included and executed under development environments (for example writing text into a log file to help understand what might have happened when a rare bug occurs) but this code is not present in final submission builds. It makes sense to include "cheat modes" in this code for the reason stated above.
For reference, I included an "autoplay" cheat in a game I submitted to Sony which demonstrated that all the Trophies could be collected (some were pretty hard to get) thinking it would speed up submission as it would test the Trophy collection for them. They rejected the submission as the same cheat then violated one of their rules that Trophies must require effort from the player to earn. The cheat was intended to ease the submission process, but in reality it delayed it.
In the early days of game development, few knew how to make a balanced game, and of those that did, didn't always have time to meet their launch window and make it balanced; most games were in the category of Nintendo Hard (warning: TV Tropes). Programming was also time-consuming, so it was often easier to program a cheat code in for testing, and it didn't always get taken back out again. The same is often true for other kinds of assets as well; many times assets like sprites, animations, music, and code are left-over on the cartridge, disc, or inside the game files. These are left-over artifacts from not having enough time to do everything a developer wanted to do.
The first major blows to cheat codes were the introduction of difficulty options and improved developer tools. Developer tools allowed for faster build times, more advanced programming languages, etc. Cheat codes were less necessary, because developers could quickly change memory and code. Difficulty options basically split gamers into two groups. The hardcore gamers that thought the challenges were rewarding and there shouldn't be an easy mode, and the casual gamers that thought a game should be accessible to (almost) everyone.
If a hardcore gamer-programmer had to introduce an easy mode for marketing reasons, it was usually in a mocking manner, like Doom Guy's baby pacifier face on "I'm Too Young To Die" difficulty. Much later, more accessible games would introduce a casual player's quick mode, called "Story Mode", with limited or no combat and no challenge whatsoever. This is the mode you're likely thinking off when you talk about a game you want to just enjoy quickly. At any rate, almost any game with difficulty modes was already easy and fast enough for a casual player, so introducing cheat codes wasn't necessary. If a game had codes, they were easter eggs or cosmetic differences.
Eventually, DLC became readily available. At first, it was just cosmetics or maybe a decent starting boost to the game. After a while, games were just designed to require absurd amounts of grinding that was fixed by paying some price for a triple-experience DLC. These games were designed to frustrate players, so no cheat codes here. They then moved on from this to energy meters and progress meters that ran in realtime, which you could advance faster by purchasing in-game premium currency, known as microtransactions. They also started adding loot boxes and battle passes for extra rewards that would move you along faster, and other pay-to-win mechanics. Cheat codes are antithetical to the concept of pay-to-win.
Also, keep in mind that many modern games are also live services. That means that you can play with other players, and you'll see their cool items and abilities, and want them for yourself, so they'll offer loot boxes and battle passes and everything else to entice you to spin money so you can be powerful and/or cool like that one person you saw.
In addition, a lot of game engines had "mod" capability. Anyone with skill could make a game do pretty much whatever they wanted to. You no longer had to cheat, just install a file to customize the game the way you want to. Any game with this system was also unlikely to have any built-in cheats, since the players could already customize the game however they wanted to. It simply didn't make sense to include a cheat mode. Also, games started introducing multiple game modes, like Minecraft's Creative Mode, where a player could build without fear of dying.
Most modern games don't have cheat codes (except maybe cosmetics) because (a) they would not be used by the target audience (e.g. hardcore gamers), (b) the game already has a ton of accessibility features and difficulty levels, (c) the game is intentionally grindy to extract dollars from your wallet, or (d) the game is nearly infinitely customizable anyways, so players can completely customize their experience.
As far as your specific idea goes, there are few cheat codes in modern games out there because there isn't any incentive to have them in a game in the first place. Hardcore games are not designed for casual players. Games with run long times don't really have a way to shorten the story they want to tell without cutting out critical plot elements, though many will let you skip some or most cutscenes, but that tends to leave first-time players confused. Casual games typically already have more than enough accessibility features without needing hidden codes. Microtransaction games intentionally stretch out the game time in hope of earning more dollars.
3a8082e126