Would it be possible to get a dragon to CR27 using only official material and variants (Shadow Dragon/Dracolich, innate spellcasting, etc.)? [on hold]

Ancient Gold Dragons and Ancient Red Dragons have a CR of 24. This means that, if you were to have such a dragon of the innate spellcasting dragons variety (MM p.86), they could know spells up to 8th level. I’m wondering if it would be possible to get a dragon up to CR27 (to give it access to 9th-level spells) using only official materials and variant rules.

By my calculations, an Ancient Gold Dragon has a defensive CR of 25 and an offensive CR of either 22 or 23, giving it an average CR of 24. In order to get it up to an average CR of 27, the easiest route would most likely be by raising its OCR, as it has more room for improvement. In order to get it to CR27, its OCR would need to be at least 28. The Ancient Gold Dragon gets a +2 boost to its OCR due to having an exceptionally high attack bonus, meaning its damage output would need to be equivalent to CR26, which is 231-248 damage per round on average over the first three rounds of combat.

As far as I know, making the dragon a Shadow Dragon or Dracolich doesn’t significantly increase its damage output. A Shadow Dragon’s breath weapon is more lethal due to instantly killing upon dropping a character to 0, but I don’t know how to quantify that.

Is there a selection of spells of levels 1-8 that could be given to a dragon in order to get its OCR up to 28? Or is there another way to get a dragon to CR27 that I’m overlooking?