Thanks @DTS Engineer for your response and links. I used plutil to validate my entitlements file. And it said OK.
But as @Etresoft suggested I ended up adding more and more flags, until I had added about every flag I could find (eg. from https://developer.apple.com/documentation/security/hardened-runtime). Alas, it didn't help.
I think what I'm struggling with is https://developer.apple.com/documentation/xcode/embedding-nonstandard-code-structures-in-a-bundle. I'll have to give that a closer look. All my Perl modules and helper binaries certainly aren't in standard locations.
Topic:
Code Signing
SubTopic:
Notarization