[6.2] Build CMake on macOS if one is not preinstalled
We build CMake on all platforms (except Darwin for an unknown reason) if CMake is not preinstalled. Since CMake 4.0 regresses certain build configurations, there's currently no way to build on Darwin without installing an older CMake version 3.x manually. This can be simplified if we build a pinned version of CMake consistently on all platforms.
Addresses rdar://159939866
(cherry picked from commit 7db6c5ddaa9f41f57e5be0adaf9f38e98cded238)