Artifacts
Artifacts typically provide game-breaking abilities, even for level 20 characters. Even your example of level 10 spells can be achieved in some circumstances. The Book of Exalted Deeds has this:
Enlightened Magic. Once you've read and studied the book, any spell slot you expend to cast a cleric or paladin spell counts as a spell slot of one level higher.
Other artifacts typically offer particular spells which can be cast a number of times per day.
Magic Items
Level 20 characters are expected to have a couple of these even in lower magic campaigns, but the more the merrier.
Wands and staves are clearly thematic in terms of spells cast per day. However, don't overlook the various Tomes, which can increase your casting stat up to 30, and thus improve your casting effectiveness.
Epic Boons
Epic boons are provided at DM discretion, but come with a variety of possible spellcasting benefits. You could gain things like an additional 9th level slot, the ability to cast a level 1 spell at will, or the ability to cast a spell without consuming a slot (even 9th level).
Epic Boons also have lesser cousins, Blessings. The examples given include increasing your casting stat (and thus all your spellcasting).
Feats
These can be trained as rewards, according to the DMG and at DM's discretion, and several provide additional magical abilities. Magic Initiate and Ritual Caster from the PHB give some flexibility. Tasha's offers several, including Artificer Initiate, Eldritch Adept, Fey Touched, Metamagic Adept, Shadow Touched, Telekinetic, and Telepathic.
Written spells
Wizards specifically don't have a cap on spells in their spellbooks, and may always be interested in tracking down additional spells to copy. Some Warlocks and those with the Ritual Caster feat may be interested in tracking down written rituals.
Multiclassing
There are several classes that could provide additional flexibility for casters, at the expense of the core class's capstone ability and a possible feat or stat points. While a three level dip can only net you level 2 spells, they can be upcast with your higher level spell slots. Any such class will noticeably increase your number of cantrips.
The Pact of the Tome Warlock will net you even more cantrips, plus the possibility of access to the Book of Ancient Secrets and the potential to learn any ritual regardless of class.
The Arcana Domain Cleric (Sword Coast Adventurer's Guide) gains some extra Wizard cantrips on top of the usual Cleric ones.
Friends
Spellcasting need not necessarily be your own. High level characters may ally with powerful archfiends, angels, fey, and deities.