In the BGE, as far as I am aware the keyboard sensor used to (prior to Moguri's fix for setting the quit game button) override the quit game button.
It is due to Moguri's addition that i understand it actually disables the quit game key binding.
It appears that if the ESC key is bound in the keyboard sensor, regardless of the current quit game button option, it treats it as overriding the end game logic, and simply blocks.
If you setup two blend files, each with just a keyboard sensor, disconnected from anything, then in both blends set the quit game button in the scene panel to Q
Then, in one blend set the keyboard sensor to ESC the other to any key other than ESC or Q (as we expect it would override Q, and i want to show the keybinding as the independant variable).
Description
Description