Isn't this pretty much exactly what happened in the late 90s/pre-3e era? People keep talking about the 4e/Pathfinder thing, but seem to forget just how dire the situation was a decade before it.
The publisher of D&D was literally going bankrupt, and D&D was very close to dropping off the face of the earth. There was a massive market shift into Magic the Gathering and CCGs. It was exactly the unimaginable apocalypse you describe, and we barely survived it. We don't have good market anaysis from the time, but games like Vampire and Shadowrun were definitely challenging D&D for superiority at the end of the 2e run, and I suspect West End Games would have been as well if they weren't bankrupted by bad shoe sales.
D&D 3e was a dream of Peter Adkinson and an independent WotC, not something that had buy in from a Fortune 100 company like Hasbro. And it was a success in terms of keeping the brand alive and historically significant in giving us the OGL (also, I personally love the rules set). But at the same time, 3e was a period where RPGs were an extremely niche hobby. Sometimes I think that people forget just how niche it was. How niche was it? In 2006, Hasbro saw their new Tooth Tunes line of musical toothbrushes as a bigger growth and profit center than D&D (
https://www.annualreports.com/HostedData/AnnualReportArchive/h/NYSE_HAS_2006.pdf).
D&D can fail. D&D has failed in the past. Multiple times. It's only in the past ~6 years that we've had this happly little spot of major attention and growth. There is no assurance it will last.