Callback when a package is removed but before recompile

I’m creating a package I want to give to other people to help with translations. Currently, I only handle the Text component but I would like to handle TMPro too.
My idea is to create a conditional compilation tag to prevent any TMPro script from compiling (and causing errors) when it’s not imported. That part is the easy one, I managed to do that. I also managed to add the tag when TMPro gets imported or when it’s already in the project and I import my custom package.
The thing I cannot manage to do is to remove my tag when TMPro gets removed. Since everything is reloading, the compilation crashes because it cannot find TMPro anymore.

I’m also completely open to any other solution than this one, as long as it doesn’t involve assemblies.

More infos : I want my package to work in Unity 2019, 2020 and 2021

Someone on Stack Overflow helped me :
https://stackoverflow.com/questions/72784103/unity-callback-when-a-package-is-removed-but-before-recompile