You couldn't change into a lich because a lich isn't humanoid or a beast
The change shape feature of the Brass dragon says (emphasis mine):
The dragon magically polymorphs into a humanoid or beast that has a challenge rating no higher than its own.
A lich is an undead, not a humanoid or beast. So a brass dragon cannot change shape into a lich. For a similar reason, you can't change into a Glabrezu, since a Glabrezu is a fiend, not a humanoid or beast.
If there was a different creature, yes, this could work for Innate Spellcasting Only
In the Dungeon Master's Basic Rules provided by WoTC, the spellcasting trait is defined as follows (emphasis mine):
A monster with the Spellcasting class feature has a
spellcaster level and spell slots, which it uses to cast its
spells of 1st level and higher (as explained in the player’s
D&D basic rules and the Player’s Handbook).
So, based on the language used, it's clear that non-innate spellcasting is distinctly a class feature which is grafted onto other creatures. As such, changing shape into the form of a humanoid with this feature will not provide you with their spellcasting ability.
However, Innate Spellcasting states (again, emphasis mine):
A monster with the innate ability to cast spells has the Innate Spellcasting special trait
This confirms that innate spellcasting is not a class feature, but a different kind of special trait. And since this trait is also not a legendary action, the dragon will gain the innate spellcasting of a creature it changes into.
So, if you can find a humanoid or beast to change shape into that can cast dispel magic using Innate Spellcasting, then you should be able to change shape and then cast it on yourself, which could dispel the True Polymorph. Just keep in mind that the dispel magic will require an ability check to dispel the polymorph unless it is cast at 9th level.