When I restart my laptop (or log off and back on again), I expect apps like Safari to open up and restore all of the tabs and windows that I previously had. I also expect that the Safari tabs will restore to their respective desktops—so, for example, if I have Safari windows in Desktops 1, 3, and 5, I expect them to open up with their corresponding tabs in Desktops 1, 3, and 5 again after I log in.
However, that seems to happen only about 25% percent of the time. The rest of the time, Safari dumps all of the windows on Desktop 1. This seems to be the behavior which I am experiencing as far as I can remember, since High Sierra at least, all the way now to Mojave.
In contrast, apps like Pages and Finder always assign their windows to the correct desktops.
Other apps have this problem, like Sublime Text and Skim, but since they are third-party apps I'll give them some leeway and won't hold anything on the developers. However, this is not the type of behavior I would expect from stock macOS apps.
One thing to note is that any minimized Safari windows that I have always stay minimized, as they should. The behavior I am describing only affects visible windows.
Is there any sort of way to make the restoring behavior more consistent during log in, or is that some sort of the bug that Apple hasn't fixed?