Why does reading the active desktop in TMainIDE.StartIDE prevent the bug also with actions done while the IDE is running? I have no idea.
I have the following supposition :
The construction of the active desktop is not complete when done by RestoreIDEWindows in TMainIDE.StartIDE.
It lacks the controls named AnchorDockSitex and AnchorDockSplitterx (as seen from debug report in lines TAnchorDockMaster.LoadLayoutFromConfig Map).
When constructing the desktop again with UseDesktop, these controls are there, and then the desktop works correctly later on.
But this remains to prove thoroughly...