As an example, consider a true dragon's spell resistance: if a CR 12 dragon, such as an Adult Green Dragon, were to gain 12 levels of an NPC class and thus become a CR 18 creature would it gain 6 spell resistance? Would the above dragon with 12 NPC levels gain +6 to its breath weapon save DC?
It depends on the ability.
Dragon's SR is specifically scaled on the CR, so if would effectively gain +6 if his CR goes by +6.
The Breath Weapon:
allow a Reflex save for half damage (DC 10 + 1/2 breathing creature’s racial HD + breathing creature’s Con modifier; the exact DC is given in the creature’s descriptive text)
As is only depends on "racial" HD (not all HD), the DC doesn't change with the acquisition of levels in a class.
You can also take the example of a dragon's spell-like abilities:
Spell-Like Abilities: A dragon’s caster level for its spell-like abilities is equal to its total Hit Dice.
Different, again: getting 12 levels of NPC makes him gain 12 caster levels
Rules by ability type can be found in the Pathfinder Bestiary Appendix 3 (pp 297-306). Most save DCs work like the breath weapon example Anne gave, i.e. they're based on racial HD and don't increase with class levels. Some exceptions:
For distraction, trample, web, and whirlwind attacks, the save DCs (+ web HP and whirlwind duration) are stated to increase with "hit dice". These descriptions aren't qualified with "racial", so taking it literally these abilities should benefit from class levels. I don't know whether this difference is intentional or just an oversight.
For spell-like abilities, the save DC isn't affected by HD at all (instead, it uses the level of the appropriate spell, similar to how vanilla spells are handled). Some spell-likes have a fixed CL, otherwise CL = HD, apparently including class levels.
Spell resistance for drow is explicitly stated to progress with character level, and for dragons with CR. Most other creatures don't have any rules given for increasing SR so I assume it's fixed, although I'd be inclined to house-rule some progression for outsiders and aberrations with class levels.