Sorry but you've not fixed it, you've found a workaround by running Xcode under Rosetta x86_64 emulation mode. This means Xcode will be very slow to build and use in general. If you want to generate a one-off code coverage report without running the whole of Xcode under Rosetta, you could use arch -x86_64 xcodebuild test -scheme {MyApp}-Package -destinationplatform="macOS" -enableCodeCoverage YES and then open the resulting xcresult file which will be added to Xcode's "Report Navigator".
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: