In Tasha's Cauldron of Everything there's a new meta magic option that reads
Transmuted Spell
When you cast a spell that deals a type of damage from the following list, you can spend 1 sorcery point to change that damage type to one of the other listed types: acid, cold, fire, lightning, poison, thunder.
and I'm wondering how this would interact with the secondary part of Flames of Phlegethos
Whenever you cast a spell that deals fire damage, you can cause flames to wreathe you until the end of your next turn. The flames don’t harm you or your possessions, and they shed bright light out to 30 feet and dim light for an additional 30 feet. While the flames are present, any creature within 5 feet of you that hits you with a melee attack takes 1d4 fire damage.
If I cast green flame blade, a spell that deals fire damage, then transmute the type to say acid, would the flames still trigger? If not would that mean that casting Booming Blade and changing its type to fire would trigger the flames?
For clarity, the part I'm unsure on is that they both say "when(ever) you cast a spell...", which doesn't really offer any clarity on which would actually take effect first.