There is code that does this in my walk search history plugin. There is a bunch more stuff to actually hook/unhook events as appropriate but the magic line is:
# Apply the popup type for this action in the toolbar
# Only update on the toolbar if it is actually visible there
if self.qaction in self.gui.tool_bar.added_actions:
self.gui.tool_bar.setup_tool_button(self.gui.tool_bar, self.qaction, self.popup_type)
Of course with all the additional toolbars etc Calibre has nowadays perhaps it is not sufficient, I haven't tested it elsewhere than the main toolbar.