macOS: Avoid relying on sw_vers when cross-compiling from another OS
We have a few code paths needed only to support builds hosted on macOS 10.4. Update the conditions to work when cross-compiling to macOS from another platform.
Fixes: #26814 (closed)