Re-spawned test binary should not break PWD (#4336)

**What type of PR is this?**

Bug fix

**What does this PR do? Why is it needed?**

This PR adds a test to reproduce the issue described in #4335,
and proposes one possible fix for it:
leveraging an environment variable to help the subprocess determine
whether it was invoked by Bazel or directly.

The test fails without the proposed fix,
but it succeeds fine with `go test`.

**Which issues(s) does this PR fix?**

Fixes #4335

**Other notes for review**

The proposed fix is one possible way of doing this.
I welcome feedback from maintainers on other approaches here.
6 files changed