Enterprise 'Dead Stop' - who's idea originally? (spoilers)

I think is was a really good episode. But the old

paradise/utopian/to-good-to-be-true facility that turns out to be powered by enslaved/cocooned people in the basement

plot has been done so many times before (especially in sci-fi stories) that I was wondering what’s the earliest example of it and who wrote it?

I’ve decided it was basically a rewrite of the TOS’sSpock’s Brainbut with fewer beautiful women.

Might think of it as a variant of Fritz Lang’s ‘Metropolis’, I suppose.

That would put it in the 30s.

I saw the people in the data core and immediately thought of Stephen King’s The Tommyknockers.

It’s ripped off from The Time Machine. No, not the recent abomination or the '50s George Pal movie, but the original novel by H.G. Wells, published in 1895. The Eloi lead idyllic, if vapid lives, supported by the brutish Morlocks, who toil underground. Don’t feel too sorry for the Morlocks, though, as they use the pampered Eloi for food. For Eloi read “rich” and for the Morlocks read “workers” and you’ll see what Wells was getting at.

I was thinking Robin Cook’s Coma, myself.