From the Pathfinder Roleplaying Game Bestiary, Appendix 2: Monster Advancement, Table 2–4: Monsters with Class Levels, on page 297, we see that class levels in Cleric, Druid, Sorcerer, Wizard are considered "key" for a monster — that is, levels in these classes "generally add 1 to a creature's CR for each level added" — only when "spellcasting levels stack with those possessed by the creature". In the case of most creatures, this distinction is either irrelevant or simple: for example, Bugbears do not have racial spellcasting at all their first two levels of any primary caster classes will never be treated as "key," and Nymphs explicitly cast as Druids so levels in Druid would be "key" but levels in Cleric would not be.
The question in the title arises from the interaction of the following rules. On page 91, it is noted:
Spells: A dragon knows and casts arcane spells as a sorcerer of the level indicated in its specific description. Its caster level depends on its age, as shown for each type.
This would indicate that, as a general rule, dragons should treat sorcerer levels as "key" in monster advancement. However, on page 108 it is noted that "* A gold dragon can cast cleric spells as arcane spells," and on page 110 it is noted "* A silver dragon can cast cleric spells as arcane spells." Looking at the spell lists of the example gold and silver dragons on pages 108–111, the presence of cleric and sorcerer/wizard spells makes it clear they do not simply replace their sorcerer/wizard spell list with the cleric spell list but instead add the cleric spell list to the sorcerer/wizard spell list.
Here is where it gets tricky.
First, does spellcasting gained from levels in any spellcasting class actually stack with a dragon's inherent spellcasting? In the case of Lillends, Nymphs, and most other natural spellcasters, the rule seems general enough to conclude "yes". But for dragons, their racial caster level is specifically tied to their age category. It is thereby conceivable that spellcasting progression from class levels would not stack at all, such that as an example an adult black dragon sorcerer 10 would have two different "spells known" entries in its stat block — one for its CL 3rd spells known (by virtue of being an adult black dragon), and one for CL 10th "sorcerer spells known" by virtue of being a 10th-level sorcerer. Or is this overthinking the issue? If so, then perhaps such a creature should instead have a single "spells known" entry for CL 13th — though I'm not sure in such case whether it should be listed as such or as "sorcerer spells known". This latter interpretation would conclude that sorcerer levels do stack and are therefore "key" for most dragons.
Assuming that sorcerer levels are generally treated as "key" for dragons, what about gold and silver dragons specifically? Unlike their kin, gold and silver dragons also gain access to the cleric spell list as they gain natural spellcasting progression via age category. By default, class levels in sorcerer do not confer this ability; though, it may be argued that something about being a gold or silver dragon — the same thing that allows them to access the cleric list in the first place — allows them to confer that expanded spell list to the spellcasting progression of sorcerer class levels. Alternately, perhaps gold and silver dragons are exceptions and do not treat sorcerer class levels as "key" because of this exact distinction.
Assuming that gold and silver dragons treat sorcerer levels as "key," then how about cleric levels? Can whatever inherent quality in being a gold or silver dragon that allows them access to the cleric spell list also allow them to gain expanded access to the sorcerer/wizard spell list with cleric levels? I am already leaning towards "no," here, because clerics are divine prepared casters with a slew of other class features — but I've included the consideration for the sake of completeness.