A logic issue was addressed with improved checks. This issue is fixed in watchOS 9.5, macOS Ventura 13.4, macOS Big Sur 11.7.7, macOS Monterey 12.6.6, iOS 16.5 and iPadOS 16.5. An app may bypass Gatekeeper checks.
https://support.apple.com/kb/HT213761
https://support.apple.com/en-us/HT213764
https://support.apple.com/en-us/HT213760
https://support.apple.com/en-us/HT213759