In the same way that it's very unlikely that your ICE engine will self-destruct when the warranty expires, the battery pack in an EV should have a long life after its warranty is up. It's also a matter of reduced capacity in most cases, not of an outright failure. How much capacity is enough? Even at half capacity the pack would have value, though possibly not to the original owner.
It will have value to someone. At the very least, it can be run through a quick diagnostic. possibly undergo a light refresh, and be put into service as stationary grid power. I just read about one utility that is doing that with tired Leaf packs.
By the time this becomes a genuine and not hypothetical concern, there will likely be plenty of companies that will remove your pack, test, inspect, replace any marginal cells, clean all connections and re-install it. (There are already a few.) Any useless cells go to the recycler. (Several facilities are already up and running.) Since decreased capacity is most frequently limited by one or a few weak cells (sometimes even a bum connection), your capacity will rebound and you'll have many years of use ahead. Just like an ICE car, when the engine finally wears out, no one buys a new engine from the factory. They get theirs rebuilt or exchange it for a rebuilt. It should be the same with battery packs.