English is not unambiguous, so there is no absolute rule. However, generally speaking the last noun is modified by the preceding nouns. "Sofa box container", has container as the last word, so it refers to a container, and the type of container is one for a sofa box.
When you hyphenate the meaning doesn't change much, so, from your example:
Queen-killer — a queen who is also a killer
Is not correct, a "queen-killer" is a person who kills queens. The hyphen just tightens the relationship.
The emphasis is the same with the genitive but the relationship is a little more ambiguous:
Queen's killer
Can mean a lot of things, the two most obvious candidates being a killer who works for the queen or a person who killed the queen. Nonetheless, the rule still applies, it is a killer, and the type of killer is "queen's".
So the bottom line is that usually the last word is the main word, the rest are modifiers.
For your example, database containing machines would be appropriate, since the main subject is the machine, and the rest say what type of machine. In this particular instance though the idiom would be just plain database machines, or database servers.
Master of ceremonies (MC) is actually a good fit here.
It's true that MC is a term used in hip-hop, but that's simply borrowed from the more general term.
MW notes that the term is from the 1600s... predates hip-hop quite a bit
Best Answer
The short answer is that there's no reason they can't mean "a demon who hunts" or "a child who abuses".
The long answer is that we won't instinctively parse them that way: in general English usage a construct like this is understood to be [attributive noun] [noun] where the attributive is modifying the one that follows.
In the case of your first example, we know we have a hunter. What kind of hunter? Demon. A hunter who hunts demons. In the second, we know we have an abuser. What kind of abuser? Child. An abuser who abuses children.