The transponders that have the problem of inadvertently selecting/transmitting "incorrect" (or emergency) codes are old-tech designs. Much like the old-tech radio designs there was no concept of "standby frequency" or "code being entered" - whatever was on the face of the instrument is what it's doing.
Radios of the same vintage have the same interface (e.g. the KX-170b):
The usual solution for the old-tech transponders is to think before you spin the knob. If you were squawking
7701 and told to squawk VFR (1200 in the US or 7000 in most of Europe) you wouldn't turn the right-digit until you'd adjusted one of the other two so you wouldn't inadvertently squawk one of the emergency/alert codes.
(The radar system could still see you squawking the "wrong" code for one or two passes in this situation, but that's a self-resolving problem and it generally doesn't set off any alarms for ATC.)
Modern (push-button entry) transponders do have an "inactive" squawk code in that then new code isn't transmitted until after you're done entering it. Most also have a clear or one-touch VFR button in case you make an error entering the new code, so if ATC assigned you code
7001 and you inadvertently punched
77 in turbulence you don't need to keep entering a "wrong" code - just hit clear or VFR and try again.