VectorTemplate has various methods with very similar logic. These are buildNamespacesProps, buildVariantsProps, buildViewsProps, buildActionsProps and buildPersonalProps
I suggest we DRY this up into a single method called getMenuData and append any additional data where needed to make it obvious how these different menus differ.
T253905: Vector page layout corrupted on cached pages
T253819: Regression: Dancing Search Bar in MediaWiki when menu is hidden
T253912: gadget regression: addPortletLink doesn't reveal hidden menus in Vector any more [causes disappearance of merge datas on Wikidata]
T255069: "More" menu in Vector is no longer accessible except by mouse hover