Yeah! I think the difficult part of this idea though is maintaining/moving the necessary dependencies, or at least keeping track of them to warn that they're no longer satisfied.
In many cases it probably requires awareness of packaging in a way that normal AST manipulation does not, at least to be particularly useful it would.