I mean, I don't know the level of optimization of this party, but at the table I play at, all very experienced players? I would not only give the dragon spells, I would let the dragon attack or breath, and cast a spell every turn, and give it legendary actions (including the ability to cast a spell off-turn). The dragon is working 6 v 1. If it doesn't enough actions to roughly equal how many actions the players are getting, it's gonna get wrecked.