Solved by splitting the base class (PanelMenuButton) in a separate module, ui.panelMenu, which is meant to hold also other reusable button classes. https://bugzilla.gnome.org/show_bug.cgi?id=621705