Hi
This looks like a Windows Explorer/taskbar refresh issue when the display configuration changes, rather than the windows themselves being lost.
When it happens, press Ctrl + Shift + Esc, find Windows Explorer in Task Manager, right-click it and select Restart. This should refresh the taskbar without having to toggle auto-hide.
As a workaround, you can also go to Settings > Personalization > Taskbar > Taskbar behaviors and temporarily change When using multiple displays, show my taskbar apps on to All taskbars, then test disconnecting the dock again.
Microsoft's taskbar settings reference: https://support.microsoft.com/en-us/windows/customize-the-taskbar-in-windows-0657a50f-0cc7-dbfd-ae6b-05020b195b07
If the issue continues even with Windows fully updated, I would recommend reporting it through Feedback Hub, as the taskbar is not refreshing correctly after the monitors are disconnected.