I'd argue literature, as all our ideas, is a product of the material conditions first and foremost. In an age where you have a lot of technological advancement, you see literature that extrapolates into the future. It's inevitable that people seeing rapid technological advancement all around them would think about how it will reshape society and open up new frontiers.
And this is precisely what we see happening in China right now where popularity of sci-fi is exploding https://www.globaltimes.cn/page/202411/1322883.shtml
But in the west, technological progress has stalled. There are no grand technological projects being pursued. There's no collective vision for the future. And so you see literature reflect that with escapism into fantasy or post apocalyptic fiction.