Using the DMG monster creation guide, the Archmage has effectively Defensive CR of 6-7 WITH its buffs up (the immunities of mind blank, resistances of stoneskin and magic resist boost its effective HP), and an offensive CR of 12, assuming he uses Cone of Cold on 2 targets (it assumed a breathe attack would hit 2 in its calculations, so we will assume this will as well, as it's similar).
This gets our actual final CR as 10, 2 below its actual CR. However, its reactions (counter-spell) and bonus actions likely account for the difference.
So it looks like they counted his buffs as active in their calculations. However, it is important to remember that CR is only a very rough value of the difficulty of an opponent. An Archmage would almost never be caught in an unfavorable position (Int 20 means they are literally the smartest mortals around).
Also, the fact that the AC and Damage resist include the spells effects is a big hint they are included.
Honestly, without these spells, the CR would only go down by 1 or maybe 2 (since defensive CR is averaged with offensive, any change will be halved for final CR). And, in general, the CR of creatures aren't changed when they are just in a favorable or unfavorable circumstance. In many published adventures, monsters have quite an advantageous position without being granted bonuses to their CR.
For example, one vampire in a published adventure gets the benefit of Truesight, while also having its chamber covered in magical darkness. Together, these are a substantial benefit, but the adventure doesn't suggest altering the CR.