It mysteriously got resolved when I changed my code signing settings to sign manually with a local provisioning profile and then changed them back to automatic. While uploading the build to App Store Connect, I had to enter my password several times to access the certificate. This seems to be a bug in Xcode or macOS.
Topic:
Code Signing
SubTopic:
Entitlements
Tags: