SkinVector::getMenuData is made more complicated than it needs to be by the fact it uses logic to add a "collapsible" CSS class to all elements that can be collapsed under the more menu (all except the watch star).
However this CSS class is only needed with JavaScript! In fact a one it's just a one-liner $( '#p-views li' ).not( '#ca-watch, #ca-unwatch' ).addClass( 'collapsible' );
As a result I propose moving this logic to JS and removing the complicated PHP processing. This will also make it easier to upstream to core.