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.
No the Couatl cannot gain Spellcasting using Change Shape
[The Couatl] gains any Statistics and capabilities (except Class Features, legendary actions, and lair actions) that the new form has but that it lacks.
Spellcasting is a class feature, even for monsters
According to the introduction to the Monster Manual:
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...
The monster has a list of spells known or prepared from a particular
class. [...] The monster is considered a member of
that class when attuning to or using a magic item that requires
membership in the class or access to its spell list.
So the rules say that Spellcasting is a class feature even with monsters. In fact, the association with a class seems to be the distinguishing difference between Spellcasting and Innate Spellcasting (and there is indeed a difference). In this case, the Hobgoblin Devastator is considered to be a member of the Wizard class even though it doesn't say Wizard anywhere on it stat block.
This has been clarified and confirmed by Jeremy Crawford:
The Spellcasting trait in monsters is associated with a class, as explained in the introduction to the Monster Manual. That's a class feature.
Because Spellcasting is a class feature, the Couatl will not get this ability when it uses Change Shape to turn into a Hobgoblin Devestator.
Best Answer
The only trait that is a class feature in the Monster Manual is Spellcasting
Since there is no general definition for a class feature, something is only a class feature if a rule says it is. The class features in the Player's Handbook, and other supplements, are clearly labelled as such:
The "Introduction" to the Monster Manual talks about monster traits, where the only mention of class features lies in the Spellcasting trait (emphasis mine):
All other traits are just special traits with no connection to class features. As such, only if the form assumed has the Spellcasting trait or PC-levels will any traits be blocked by the relevant clauses of Change Shape.