There are a couple of extensions you may try. First one is Pixel Saver.
Pixel Saver is designed to save pixel by fusing activity bar and title bar in a natural way.
But it doesn't provide any customisation options.
Second one is a new fork of Pixel Saver called No Title Bar. It provides options like disabling/theming window buttons, whitelisting/blacklisting applications etc.
Update
None of the extensions I mentioned provide a global menu. They can be used to merge the header/title bar of maximised windows with the top panel. I believe that's what OP wanted as they originally wrote
Can I somehow do the merge as in the picture so that the top bar is along with the header, as it was in Ubuntu Unity. (sic)
There is an extension called Gnome Global Application Menu(HUD for Gnome) which claims to provide a global application menu.