I have two bikes and six batteries, friends regularly ride my second bike. Four of the batteries are from 2016-17 and two are from 2022. Three of the four older batteries have lost about 20% capacity and one 50%.
This is very impressive!
The motors last a long time. One of the few instances where it runs into issues is in very humid conditions, i.e., coastal areas with seawater - this can damage the bearings and lead to rust/corrosion.
In motors equipped with internal belts, timely replacement of belts will help you get high mileage.