Optimize template expansion

Failed in 33m 57s
:pipeline:
:fedora: Fedora 39 (OpenJDK 17, gcc 13.1.1)
Clang on :ubuntu: Ubuntu 20.04 LTS
Windows (arm64) on :windows: Windows
RBE on :ubuntu: Ubuntu 20.04 LTS
Docs on :ubuntu: Ubuntu 20.04 LTS
1/4
:windows: Windows (shard 1)curl -sS https://raw.githubusercontent.com/bazelbuild/continuous-integration/master/buildkite/bazelci.py?1738337834 -o bazelci.py && python.exe bazelci.py runner --task=windows --file_config=.bazelci/presubmit.yml
Waited 6s
·
Ran in 22m 0s
Total Job Run Time: 12h 7m