I found this by trying to do the exact opposite. I want to remove the navbar tabs (to replace with drop-down menus from a modification) without removing the sub-menus when on those specific pages. I have a suspicion that we are looking at editing the same code in different ways... I hope someone can drop by here and explain it.
Edit: Not sure if this will help you, but perhaps what I have discovered when trying to achieve my goal will help you:
https://vborg.vbsupport.ru/showthread.php?t=244658