This is a special post for quick takes by Richard_Ngo. Only they can create top-level comments. Comments here also appear on the Quick Takes page and All Posts page.
Perhaps the direction of causation goes the other way? In the real world, it seems like we are headed towards a situation where 1-3 giant armies of superintelligent AIs transform the planet. Whoever controls those AIs, if anyone does, will be in a position analogous to all those fictional examples you give.
All the authors of all those works of fiction know this, or at least have been seriously entertaining this AI-power-concentration-hypothesis for years.
So, they are writing fictional analogies for the situation they expect to actually happen in real life. Except of course, since they are writing fiction, it has to have a happy ending.
Their expectation that it's going to happen in real life is in fact correct unfortunately, as best as I can tell. Will the ending in real life be as happy as the endings in fiction? Of course not, but they shouldn't be taken as implicitly claiming that, anymore than Tolkien should be taken as implicitly claiming that all this mechanization, industrialization, technology, etc. that he was reacting to was going to end happily ever after in real life thanks to the plucky heroism of some country bumpkins who end up destroying it all.