Got it. You have to go to the individual emulator retroarch.cfg file. This is what mine looks like now for atari2600 and it works.
# Settings made here will only override settings in the global retroarch.cfg if placed above the includes. input_remapping_directory = "/opt/retropie/configs/atari2600/" input_enable_hotkey = "escape" input_exit_emulator = "escape" #include "/opt/retropie/configs/all/retroarch.cfg"References:
https://retropie.org.uk/forum/topic/3665/exit-every-emulator-with-escape-key
https://github.com/RetroPie/RetroPie-Setup/wiki/RetroArch-Configuration