When configuring controls on a keyboard, retropie 3 uses the same hotkey style as with a gamepad. This is so that when using arcade style controllers that map to keypresses, RGUI menu and exit is available. It also stops conflicts with other hotkeys that may be defined – which could be accidently triggered before.
You can force the hotkey behaviour by adjusting configs/all/retroarch.cfg or by using the retroarch input configuration menu in retropie-setup and choosing an alternative hotkey scheme.