It was (is) a real thing that archtitects have thought about. In 1969, the concept was named arcology. I learned about them through SimCity 2000 which helped popularize the concept.
I think, culturally, it’s an offshoot of Modernist thought. One trend in modernism is that science can be used to find more efficient ways to live, and that science will lead to human dominion over all natural processes. Some thinkers took this to one (terrible) conclusion and wondered about if people could live, work, and socialize all within one building; one efficient and contained (and human controlled) space.
Real skyscrapers were often designed with this in mind, and we still see the echoes of it today with concepts for Mars colonies and hanging-building mega-cities in Tokyo.
Whittier in Alaska is mostly all in a single building.
Yes I know about archologies, but those are all just concept ideas, which is interesting that it lead to these dystopian ideas. I was wondering if there was more to it than just that.
Look up also extremely influential architect and noted fascist Le Corbusier.
https://en.wikipedia.org/wiki/Unité_d'habitation
The building also incorporates shops including an architectural bookshop, a rooftop gallery, educational facilities, a hotel that is open to the public, and a restaurant, “Le Ventre de l’Architecte” (“The Belly of the Architect”).
It was a huge trend after the war for a variety of economic and ideological reasons.