@holmes
it is not possible to define the hotkeys combination
Exactly, this is not possible.
in N64 for example
N64 is an emulator that usually gives a headache to configure the controls (are you using the standalone emulator, or Retroach?).
Perhaps these topics will help you:
https://forum.recalbox.com/topic/9016/a-lire-manettes-n64
https://forum.recalbox.com/topic/23235/usb-n64-controller-setup
The reason may be due to the fact that the arcade controls are not unplugged (they are in the cabinet and cannot be easily unplugged) and so the USB analogic gamepad is not alone (this is a guess).
I'm not a developer and I don't have enough technical knowledge to give you a certainty, but, as far as I understand, your guess is right.
It is precisely because of the impossibility of easily unplugging that I suggested setting the control of player 1 before starting a game (in the case of the N64, for example).
I got some success with the overloading mechanism as described in the documentation. I created a .retroarch.cfg file in /roms/N64 and /roms/megadrive. I just added in them the button labels for save/load/increase volume/decrease volume.
Sorry, but, I believe this is the best option.
As you said, this option requires you to connect the Joystick that you defined in the settings, but, I don't know an automatic recognition method as you wish.
Maybe you can try the official discord, maybe someone there suggest some script or other option:
https://discord.com/invite/NbQFbGM