The automatic Curly Quotes option is a one-time Special Offer only, and as soon as they are inserted in your text, curly or not, they're going to stay that way.
... It is rather tempting to promote my own IndyFont here. ("Create a font where the curly quotes lok like straight ones and apply it through a GREP style in your 'code' paragraph style, done.") But I won't because I am a code purist
and it's not a problem to change the quotes to their proper form.
You can safely use Find/Change to change all curly quotes in code to straight ones. With a plain text search, search in turn for ' and " and replace with ^' and ^". Make sure to specifiy your "code" style in the Find Format. This will work because by default, when looking for ' InDesign finds all kinds of single quotes, curly or otherwise. The replacement string ^' in turn forces a straight quote, regardless of the setting of your Typo Quotes in Preferences.
(By the way, did you take care to switching ligatures off for your code snippets?)