You could also macroexpand in a sandbox, e.g. via LSP.
That would involve a rewrite because the way it is now, the relevant code does not use LSP.
Okay, but software is infinitely malleable