Thanks for the reply. I've recreated this scenario with a simple test app, and here is what I found:
Setting the com.apple.developer.icloud-container-environment to Production does indeed make the app use the production database.
When I run my app from Xcode, the data is synced correctly to CloudKit, and it chooses the correct database based on the entitlement, no issues found.
When I produce a Release build with this same entitlements file, no data is being synced at all regardless of the entitlement value.
I've failed to mention in my original post, but I am distributing my app using Direct Distribution. Does that have something to do with the fact that CloudKit is not syncing outside of being run from Xcode?
Finally I found that the reason I believed my archived Release build was syncing to the Development database is the following: regardless of the setting of the entitlement, the locally persisted data seems to use one shared store. And because inevitably I would run the app at least once during the day from Xcode, it would pick up the changes and save them to CloudKit, so I assumed it was the Release build, whereas in fact it was the Xcode build all along doing the syncing.