The Feds require hybrid/EV components to be covered under warranty for 8 years-100k miles at minimum. Batteries, motors, inverters, etc all fall under that coverage. Some manufacturers choose to cover them longer than that. They can do this because battery replacement in 8-9 years is pretty uncommon.
All batteries will eventually fail, but that's not much different than ICE powertrains failing. There are so many ICE vehicles that have been sent to the boneyard after engine or transmission failure that cost more than the vehicle was worth. We've seen it with Nissan CVTs, Ford's Powershift transmissions, GM and Chrysler's issues with top ends related to VVT/AFM, etc.
Vehicles of about any type depreciate over time. After 10 years of depreciation, just about any expensive repair can be enough to mechanically total a car. That could be something like an engine dropping a valve and needing replacement, or it could be something like a hybrid/EV motor needing replacement. The only real difference is that we tend to accept the mechanical things wearing out because we're used to that, while hybrid/EV stuff needing replacement is new and scary so we deem it to be unacceptable.