SF is going to drop Territory Management (aka TM 1.0) in Summer 2020.
So we are trying to migrate our managed package to Enterprise Territory Management (aka TM 2.0).
As the first step of such migration, we are building some abstraction layer at Apex code level to work with territories, hiding all the hard references to Territory object (e.g. using dynamic soql, sobject get/put methods etc.)
After wrapping all hard references into abstraction layer, we were able to deploy our code base successfully to sandbox without any TM enabled, as a proof that all dependencies are really hidden, i.e. no static dependencies.
But when it comes to our managed package, hitting upload button still leads us to the screen where Territory Management is ticked in Package Requirements section, claiming that this is sort of 'auto-detected' dependencies.
Question here: how to make managed package let this dependency go? From our perspective, it seems like there is nothing pointing to territory explicitly in our repository. Is there any way to detect why it's still considered TM as a dependency when uploading managed package? Any idea would be appreciated.