If your boss or manager wants to do some programming, there is no reason to try to stop them.
If they want to do some programming, and expect it to go into the company's products or production code, and if it is your responsibility that your products or production code are of high quality, then their code must be reviewed, and rejected if it has problems, until these problems are fixed. Just like your own code, or anyone else's code. And with the same quality requirements for acceptance.
Now if you have a boss or manager who thinks a bit of programming can't be that difficult, and his code should be put into production, no questions asked, then you have an idiot as a boss or manager. If it's a manager you might be able to do something about it. If it's the boss, analyse their code, figure out what visible bugs it will cause, and ask QA politely to check for all these bugs and report them, assigned to the boss. You can then hope that this will be educational enough. Otherwise, find a new job before the company goes under.