Recently the code for constructing menus in skins was upstreamed from Vector to core as part of T262098. Using this code greatly simplifies the Vector codebase.
The only thing that Vector would need to do to keep its HTML output consistent is
- drop the portal-first class and use nav:first-child instead
- Decorate the data from core to add its Vector specific classes e.g. vector-menu, vector-menu-dropdown, vector-menu-tabs, vector-menu-portal
The change will require various template changes given the data will be sourced from places with different names to those used by Vector so there is a small amount of risk, that can easily be mitigated by verifying the HTML before and after the change.