At a previous job we put compilers and standard libraries in version control, with custom tooling to pull the right version for what you need.
We used p4 rather than git though.