The short answer is that you may employ the simple past perfect to express a continuing action only when the expression is atelic or bears in context a reasonably natural atelic interpretation.
A telic expression is one which has a goal or ending point "built in" to its sense—finish, for instance. Employing the test suggested in the article linked above, it makes perfect sense to say He finished in an hour, but not (normally) He finished for an hour.
Expressions which do not have such a goal are atelic. In your first example, work is an atelic expression: using the same test, He worked for an hour is acceptable, but not (normally) He worked in an hour. Atelic expressions are, so to speak, inherently continuous. Consequently, a simple past perfect construction use supports a continuous sense; this is why the two are "interchangeable".
Your other examples, however, are telic. Eating dinner and cleaning a room are not (normally) protracted indefinitely, they come to an end when the dinner is consumed and the room is clean. Consequently, using simple perfect constructions implies completion, and if you want to convey that the action continues you must employ a progressive construction.
Note, however, that "telicity" is a very subtle matter in practice. As the linked article tells you, grammarians are in some disagreement over just how it works; and I have been careful to qualify all my analyses with the (normally) tag.
Note, too, that there is an alternative to the two constructions you illustrate. The past progressive ("I was eating dinner when ... " and "I was cleaning my space when ... ") is more natural to my ear than the past perfect progressive. You want the past perfect progressive only if you employ a qualifier like since dawn, which removes the focus from the present-in-the-past to the past-in-the-past, the stretch of time which preceded the present-in-the-past.
My apologies as I am new to this and am not fluent in the meta-language necessary to explain complex grammar, but for me '...as if she had been an infectious disease' doesn't work in terms of what the author is trying to convey. I agree with Apollyon's assessment of the way the sentence comes across.
For me, you need to make a distinction between an imaginary situation in the past from a present perspective (as in 'if I had been an infectious disease...') and an imaginary situation within a narrative structure in which the perspective/point of view is already in the past (as in 'The Lady Blanche avoided her as if she were an infectious disease'). In the former we are looking backwards, requiring past perfect, in the latter we are looking 'across', requiring past simple.
There is probably a much better way of putting this!
Best Answer
"He seemed as if he hadn't slept for days" should be either "It seemed…" or "He looked…"
"He looked as if he knew the answer" would be better as "It looked…"
"She looked as if / as though she had known everything" should be "It looked…"
"He seems as if he hadn't slept for days" should be "It seemed…" or "He looked…"
"Peter was extremely hungry and ate his dinner very quickly. He ate as if he hadn't eaten for a week" is grammatically acceptable but "ate / eaten" isn't a great choice.
"He ate as if he hadn't fed for a week" would beat "ate / eaten"
"He gobbled his food as if he hadn't eaten for a week" would beat "ate / eaten"
"He fed as if he hadn't eaten for a week" would beat "ate / eaten"
(Unless of course, you're Clive Cussler, who uses forms like "ate / eaten" and even "eat / eaten" on most pages and is still one of the most successful authors ever…)