Gave this a go using xcodebuild, but the build fails when "Build for Testing" (regular build works), both in xcode and our CI.
We are using a macro target in our Package.swift. This target is used by a Macros package that is then imported by other modules. Legacy previews is off, as mentioned in other comments.
cannot load module 'SwiftSyntax' built with SDK 'macosx15.5' when using SDK 'iphonesimulator18.5' appears for the macro target.