As a DM, I've always interpreted it to mean that as long as the thing you've transformed into can cast spells, you have access to all your spells, especially for Warlocks and Wizards. Warlocks and Wizards LEARN their spells. This whole "only what the stat bloc" says is actually crap. I understand that their mental statistics change, but their memories don't. For wizards, they still have their spell book and still understand how magic works, as long as their Intelligence isn't less than, say, an 8. They may need an Int check for higher level spells if their int is too low, but a Wizard's magic isn't based on something within themselves, it's based on what they have learned.
Same with a Warlock. They KNOW their spells, they don't channel them like a Cleric. They were taught. Just because you change yourself into a dragon doesn't mean you suddenly forget how to bend magic, especially if your new form has everything it needs to bend magic.
So saying "Well, you could turn yourself into an Archmage..." I can't even go on, that's ridiculous. You do not gain the memories of the person you change into. So you may become as smart as them, but they spent time and study learning their spells. You didn't. Racial abilities, natural magic abilities like what a Drow has, sure. But if you turn into an Archmage, you keep your own spell list. You do not gain the new one. That's stupid.
I understand that this may not be the way it is written, but it is the way it would naturally work. If one of my players reaches level 20 and gets True Polymorph and wants to become an Ancient Brass Dragon permanently and use the Shapeshift Feature to become his own human self while keeping all his class statistics while in Human form, I will say "Sure." They're level 20. If them being a dragon is going to break my game, then I'm not giving them enough of a challenge.
Edit: Note, I may have a different answer for Sorcerers, as Sorcerers gain their magic through their innate bloodlines. If that changes, they no longer have that bloodline. I would allow a Dragonic Sorcerer to retain their magic after becoming a Dragon, but not, say, a Shadow Sorcerer. Unless they became a Shadow Dragon. Hmm. I'd have to think about that.