Handle multi-arch sysroots on Apple platforms

This allows building fat builds where the architectures have different
SDKs, e.g. iOS simulator (x86_64) and iOS device (arm64).

Fixes: #19534
Status Job ID Name Coverage
  External
passed ghostflow-check-master