Did you try using the CODE_SIGNING_ALLOWED=NO . We also struggled for days looking for a solution to build an app for E2E tests without development client and this worked for us. So the full command would look like this:
xcodebuild build-for-testing -workspace Test.xcworkspace -scheme Test -destination generic/platform=iOS -allowProvisioningUpdates CODE_SIGNING_ALLOWED=NO
Of course it is not a publishable version.