Not sure if this a bug or by design, but if you have the Examine panel open and press the escape key it will instead open the in-game menu. If you press ESC a second time it will close both the Examine and In-Game Menu at the same time
All other UI elements instead behave by pressing escape will first close them and only when they are all closed will it then open the in-game menu.