As with many things Apple, this issue is an entitlement, and you can find some documentation of all possible MacOS entitlements here.
Specifically, once your app is signed it's trapped in a sandbox environment, and the only light filters through gaps provided by those entitlements. In the case of a gamepad, we're talking either USB (wired) or Bluetooth (wireless). This means you'll want to add this to your MacOS app's entitlement file:
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
Do that, rebuild, re-sign, and you should have working controllers in your build.