GoogleTest: Avoid cluttering custom working directory during discovery

Backport the functionality from commit b5f555f687 (GoogleTest: Avoid
cluttering custom working directory during discovery, 2026-06-07,
v4.4.0-rc2~12^2). Work around the refactoring done in commit 3748ca9fc7
(GoogleTest: generate single discovery script, 2026-04-08,
v4.4.0-rc1~302^2~1).
2 files changed