This sort of thing seems to have really fallen off after the Grand Theft Auto "Hot Coffee" scandal. Having hidden stuff in a game went from being a fun thing to a potential liability.
Yeah I remember when Hot Coffee happened I was working at a studio owned by THQ and a message came down from the executive level basically warning us not to put in anything hidden like that. All secrets had to be disclosed and known by the executive team. Something like that anyway.
1. I think it's more about microtransactions than Hot Coffee. Why put cheats for free if you can monetize them.
2. Cheats don't make sense in the age of abundance of games. Previously you'd have 3 games on your PC and you'd try to extract as much fun out of them as possible, so you'd just dick around and do silly stuff, and cheats were helpful in that. Now most gamers literally have a backlog of games, there's no time for that style of gameplay. You're done with the campaign, next game.
3. "Fun" has always been a liability, it's just that previously companies saw that as cost of doing business while nowadays all risks need to be avoided. Doing borderline illegal marketing campaigns was actually normal for many companies. When Burnout 2 was being released in 2002, Acclaim wanted to reimburse speeding tickets in the UK. Think about it for a second.
4. Children playing a literal gang member simulator with all types of violent crimes built in? Business as usual. Penis into vagina? That's a step too far you monster! I never really understood this moral panic about sex. In Europe GTA games are labeled 18+ so Hot Coffee scandal was contained to last pages of video game magazines.
I think the other big thing that killed in game cheats and debug screens was Xbox and Steam Achievements/PlayStation Trophies. Some of the "value" in such tokens of game completion are the "skill checks" it takes to complete them. If a game provides cheats inside of it, it either needs to disable those Achievement systems, or it loses the ability to unlock them, and that's platform enforced by Xbox/Steam/PlayStation. So it's easier for most games to just not include cheats so they don't have to worry about accidentally violating platform terms on Xbox/Steam/PlayStation should players discover and "abuse" the cheat systems.
Similarly PC games with mod support often have to disable Achievement systems as soon as any mod is installed just in case the mod happens to offer cheats. Which also seems to have impacted mod culture to some extent with entire classes of gamers not installing mods ever to make sure that they still win Achievements.
It's an interesting social dynamic and I think one of the clearest lines in the sand for when cheat codes disappeared, especially in genres like the FPS where "God Mode" and "noclip" codes were genre staples until Achievements. (Because DOOM offered them, every FPS offered them. Until they stopped.)