The Timken bearings we used on the conveyers at my old job were of a similar size to the bearings in an ebike. they were rated at 200,000 hours use, but most were much older than that. thats better than 20 years continously running under load. And at 20 years, the rubber seals are about ready to dry rot and let the grease dry out.
So that being the only moving part in a hub motor, the motor could go on for ever if the bearings can be serviced.
As for batteries, that depends. last year I replaced the nicad battery in my cordless phone. it had survived 18 years and was still at 50% capacity. it had survived being owned by several family members, and has had a long and active life. So the right battery could last a very long time. LiFePO4 are said to last 10 years, or 2000-3000 cycles before dropping to 80%. Unllike a hub motor, a battery has a finite life, but 5 to 10 years isn't unreasonable.
I imagine technology will make most componants obsolete before they wear out.