I ran across this issue with depstar but observed that tools.build behaves the same, possibly incorrect, way.
See https://github.com/seancorfield/with-dir-repro
If you wrap (b/create-basis ..) in with-dir from tools.deps.alpha, it calculates the basis from the deps.edn file in the context of the with-dir location.
However, if you use that basis with tools.build functions, they do not behave correctly -- even if they are also wrapped in the same with-dir context.
The dependencies come from the project deps.edn (Clojure 1.9.0 in this example) but the src used is from the root of the repo, not from the project folder.
This is counter-intuitive (and took me a while to track down with depstar -- where I definitely consider it to be a bug).