Move fileset utility method to a better place.

Failed in 49m 34s
:pipeline:
Print Test Summary for Shards
5/5
:mac: macOS arm64 (shard 4)curl -sS https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py?1720032434 -o bazelci.py && python3 bazelci.py runner --task=macos_arm64_v2 --http_config=https://raw.githubusercontent.com/fweikert/bazel/macos_v2/.bazelci/postsubmit.yml
Waited 8s
·
Ran in 41m 26s
Total Job Run Time: 12h 24m