.asmref conditional disable

I want to extend some 3rd-party package. asmref works fine, but only when target package exists in project.
I want to dynamically enable/disable my extension based on the package presence, just like with Version Defines in asmdef. Why there’s no such thing for .asmref?

Isn’t there a way to achieve this?
I can’t use asmdef, because I am extending a 3rd-party partial class, so my extension has to be inside a 3rd-party assembly.

Literally any asmref will become useless if no target assembly exists. Now this will result in a compiler error. Why doesn’t unity disable this invalid assembly automatically? Any way to disable this manually instead of deleting the whole extension? Am I missing something?