Even if EF lenses are discontinued, that doesn't mean they'll instantly stop working and compel you to replace them all!
It's a bit like computers, when PCs first became popular in the late 90s we had to upgrade or replace them pretty much every year as they would no longer cope with improvements in operating systems and the latest programmes (aps as people now seem to call them).
However, the need to replace or upgrade became less frequent because eventually computers did what we wanted them to do, and did it fast enough not to be a nuisance to our workflow. These days, a good spec computer will probably not need upgrading or replacing for several years.
I believe the same has happened with DSLRs... just how good do we want or need something to be? Something like a Canon 5D iv or Nikon D850 will do most jobs and deliver great looking results. How much can that be improved to the extent you'll instantly want to upgrade?
So, as a camera manufacturer, what would you do to maintain camera sales? You'd probably develop an alternative system and hope the 'buzz' surrounding it will make people believe they need to change. Will that result in a massive difference in image quality or usability? Probably not for a number of years, but people will believe they need to change, so sales will happen.
So I'll be sticking with my EF lenses for a while to come yet, whether they're discontinued (or more likely just allowed to stagnate development-wise) or not. As the saying goes, there's many a good tune been played on an old fiddle.