It was indicator-appmenu, which took the menus of GTK, Qt (and XUL?) applications and made them available for the Unity shell.
I'm not sure if they ever added other toolkits to it, but it seems like it was a manual implementation for each toolkit.
wiki.ubuntu.com/DesktopExper…
As for hiding the menus in windows, I wouldn't be surprised if they used modules or patches for some toolkits to make that happen. Qt in particular seemed to have a special flag for this.
Nice hack you can do: set `org.gnome.desktop.wm.preferences.button-layout` to just `appmenu` if you use a tiling window manager to remove the close button on GTK apps :P