UnityCloudBuild: Codesigned with Sandbox enabled, but still get ITMS-90296: App sandbox not enabled

I've made an MacOS app with Unity Cloud Build and I want to sign and distribute it using App Store Connect.

I download the compiled .app file and use codesign to sign all the appropriate files. I also use an entitlements file when I sign the runtime binary.

I used the command codesign -d --entitlements on the resulting .app file to confirm that com.apple.security.app-sandbox is set to true, which it is.

But when I use productbuild to create the .pkg file and upload it using Transporter, I get an e-mail from App Store Connect saying that "ITMS-90296: App sandbox not enabled"

I don't know how to further debug this... Does anyone have any pointers on how to fix this?

Note: it has to be doable either via the Unity Editor, Unity Build Cloud or the MacOS CLI...

Codesign showing that app-sandbox is enabled:

The error from App Store Connect:

UnityCloudBuild: Codesigned with Sandbox enabled, but still get ITMS-90296: App sandbox not enabled
 
 
Q