When the battery runs out, you pull over and “pedal” to recharge the battery, then you’re good to go again!
I don’t own one of these, but that sounds actually useful if for example I’m about to climb a big hill and want to pedal at a less strenuous pace (but for more time) than would be needed to overcome the slope.
Assisted modes already exist, and regenerative braking already exist
But do e-bikes have regenerative braking? I haven't seen that. I've been thinking that it would just be too heavy and clunky to be worth it.
Too heavy? You just run the motor in reverse which turns it into a generator and adds friction to do generative braking. There really isn’t any added weight.

Bikes normally have freehubs, a ratchet on the cassette (sprockets) of the rear wheel, when you stop pedalling the bike freewheels, without that the pedals would keep turning.

This makes driving a motor from the wheel impossible without heavily modifying the normal bike mechanics. That’s why regenerative braking on e bikes is rare.

Not if you have a hub motor. Those don’t interact with the gear system at all.

Only very cheap e-bikes have hub motors. They’re not a good idea precisely because they don’t interact with the gearing system. So you lose that functionality.

It’s not worth losing access to gearing just to get regenerative braking because the amount of power being used isn’t worth trying to recoup.