CNC machines from the manufacturer point of view have a lifetime similar to cars[from the same point of view]
So, basically, batteries last the life of the machine
AFAIK all machines with incremental encoders have to home, so none keep track of anything when the machine is off. Even my machine with an absolute encoder reads it on startup.
CNC machines are very conservatively designed. Flash memory and SSD drives have only become cheap in the last 5 years or so, and, as mentioned, have a finite lifespan.
Generally, if you store your parameters and programs, battery loss is a minor nuisance.
I changed my old heidenhain from 3 AA to 3 D cells because the factory holder rotted from old batteries. Shoulda bought lithiums, but ......