This is only really possible with modern game engines though. Older games were often using code that was written specifically for that game. So simply disabling the cheat codes could likely break things elsewhere in the game. But modern game engines that were written with those testing tools in mind are able to safely disable the cheats before release without breaking the rest of the game.
They still have the QA stuff, it’s just done differently. An in-game terminal that’s disabled for the release build, for instance.
This is only really possible with modern game engines though. Older games were often using code that was written specifically for that game. So simply disabling the cheat codes could likely break things elsewhere in the game. But modern game engines that were written with those testing tools in mind are able to safely disable the cheats before release without breaking the rest of the game.