I think you need to clone cmslistmenu control and customize it (or use the condition below in your logic). In the code behind there is an event in cmslistmenu.acx.cs which sets visiblilty:
/// OnPrerender override (Set visibility).
protected override void OnPreRender(EventArgs e)
Visible = menuElem.Visible;
if (DataHelper.DataSourceIsEmpty(menuElem.DataSource) && (menuElem.HideControlForZeroRows))
Visible = false;
Just add you
subNavigationWrapper.Visible = false; in there if youare customizing it or use the condition above in your code