Inherit transitive dependency resolution from parent environments

Assume I have an environment with packages X and Y, where X and Y both depend on a common package Z.
If I ] add X, I would get v0.2.0 of package Z.
If I ] add X, Y, Pkg resolves Y’s compat restrictions on Z, and I get v0.1.0 of package Z. Let’s call the environment that has both X and Y in it the “parent environment”.

Now, I want to ] add X while being wary of Y’s compat restriction without actually adding Y, i.e., when I do ] add X , I want Z to automatically resolve to v0.1.0 instead of v0.2.0 .

Is there any way I can do this?

I also have access to the parent environment (both, Project.toml and Manifest.toml are accessible), so is there some way I can inherit the transitive dependency resolution followed in the original environment in a new environment where I want to add only X and have Z set to v0.1.0 instead?

Can I use the Pkg.Types.EnvCache() (or something else from Pkg internals) of the parent environment in some way, to achieve this?

Basically what I want to do is tell Pkg -

“Here, take this EnvCache (or whatever other Pkg internal is better suited for this), see how/to what version you’ve resolved this dependency before, and do the same again.”

So far, manually parsing the Manifest.toml, figuring out the dependencies and adding Z@0.1.0 seems to be the only immediate solution.
I would however love to know if there are any alternative solutions and/or if Pkg itself supports this in some way.