Something more complicated has happened than that. We have left behind a world where there was a well-regulated Canon of literature, and where the masses paid attention to scholars who would identify that Canon. We live now instead in a world where taste have become democratized, and more subject to market forces than to elite judgement. So even though I am told great literature is still being written, most people don’t get to hear of it, because most people aren’t listening to literature specialists.
In the other direction, and strongly correlated to this, high literature, just like high art and high music, has withdrawn from the conventions that helped it make sense to the masses for millennia, in favour of more experimentation, and in the case of the visual arts, philosophising about the nature of art. That’s not intrinsically a bad thing, but it has happened to the extent that it has, because the market forces of popular taste no longer have much sway over it. Admittedly such hermeticism (for want of a better term) is most severe in the visual arts, decreasing in music, and I think least pervasive in literature.
Greatness in art is something we like to think is inherent in the artistic expression. But greatness is just as much, and arguably much more, about the reception of the art, and what sense a mass audience makes of it.
Hermeticism does not prioritise the mass reception of art, and usually seeks to undermine the very notion of great art. So greatness does not come naturally to it. And conversely, without a mass audience for high art, and with a body of scholars and critics who themselves question the very notion of greatness, people or not as invested in identifying greatness in Contemporary Art as they used to be.
Tl;dr: there is still great literature being written. But you have to look very hard now to find someone who’ll tell you what it is.