In gnome-shell, menus on the top panel are flat -- submenu is not displayed on the side, as it used to be, but is opened in the upper level:
Is there a way to change the behavior back? Is it hard-coded, gtk3 theme, gnome-shell theme or something else?
You're using the Applications Menu Gnome Shell extension in the screenshot. Its homepage is here. You could get involved by contacting the developers, contributing to their code, etc. You could even make your own extension that would open menu contents to the right as opposed to a drop-down. As far as I know, the Applications Menu Gnome Shell extension doesn't offer the option of making menu content expand to the side.