At the C-code level you can check the creating_extension global variable,
or maybe better look at the in_extension fields of CollectedCommands.
That was the hint I needed, looks like pg_event_trigger_ddl_commands() has an in_extension boolean that seems like it will do what I need? If I understand you correctly that's what you're referring to with CollectedCommands. Testing it now but that looks like the answer for me, if any of those are true then I can just skip the regeneration.
-Michel