Hyphenation or blending
Solution 1:
The rule is that there are no rules. But, there are some general trends....
Before English lost the genitive case, the first noun would have been declined in the genitive to represent that it owns or modifies the second noun. We actually still see some compound words with a remnant of the Old English genitive. For example, the -s- in Doomsday is declining doom into the genitive. That would be the end of the story for that word, but we don't have a genitive case anymore, so things get a little more convoluted.
English has 3 forms for compound words:
- The open form, where the compound word is separated by a space.
- The apltly named hyphenated form, where a hyphen is used as the delimeter.
- The closed form, where the words are merged with no delimeter.
The general trend is that a word starts open, becomes hyphenated, and eventually, the any delimeter that was there is removed to make the closed form.
But as I said, the rules are: There are no rules. There can be any combination of these stages in existence for the same compound word leading many to wonder, which one is more correct?. Stages can also be skipped entirely, starting out hyphenated or going from open form to closed form directly, And, still, there is yet another exception to be made for the common prefixes we have taken from Latin/Greek, those are almost never hyphenated. For example telephone, a recently invented word, was never tele-phone. But even then, there are exceptions. Some of which are mentioned here.
I'm sure a few minutes of thought and more rules can be posited and then more exceptions to those rules found. Your best bet is just to follow the most common spelling of a word on a case-by-case basis. By the time it changes and people start questioning your spelling, you'll be long since dead.