If Flash was rendered natively in the browser, sandboxed and across different browsers, and with high enough performance/low enough battery impact, it would have stayed.
There were efforts similar to PDF.js to run Flash content using JS but they were never able to tick all those boxes.