I do see your point on that one, but phrases have an origin.
Of course is like an abbreviation of something like ‘in the natural course of things’. Which has become more like just ‘yes’ over time. In the usage of ‘yes’ it’s easier to argue it could be one word.
Words also have origins and evolving meanings. Why should the preservation of the space be especially significant and load bearing? Why should "milkshake" be a word but "ice cream" isn't? Milkshakes were, after all, literally just milk shaken with ice. They had no resemblance to what we now call a milkshake, so at the time there would have been no particularly good reason to omit the space. Other than it just happened that way for milk shake, but didn't for icecream.