ID 273305 - Empty menus get cleared on startup after the menu.py has loaded

Follow

Problem summary
Empty menus get cleared on startup after the menu.py has loaded

Customer reported version
nuke.10.0v4

Customer reported platform
fedora

Steps to reproduce
1. Copy the following into menu.py:

def move_menu(menu_name, source_menu, destination_menu, copy=False):
    """
    Copies the menu item from the source_menu, to the destination_menu
    with its children, then removes it from the original menu, unless set to copy.
    """
    menu = source_menu.menu(menu_name)
    if not menu:
        print "Menu not found"
        return
    destination_menu.addAction(menu.action())
    if not copy:
        source_menu.removeItem(menu_name)

new_menu = nuke.menu('Nodes').addMenu('Test')
new_menu.addCommand('This is a command')
move_menu('Time', nuke.menu('Nodes'), new_menu) # this will fail if run from menu.py
move_menu('Draw', nuke.menu('Nodes'), nuke.menu('Nuke')) #this will work
2. Launch Nuke
Result: the empty menus are cleared

Workaround
Unknown.

Reproduced by support
Reproduced by engineering (see comments)

Expected behaviour
Expected empty menus to not be cleared

Actual behaviour
empty menus were cleared

    We're sorry to hear that

    Please tell us why