Better quality batteries. I had the same problem when I swapped out my fob batts for some spare unused one's bought the previous time - no shelf life on the pack so while stored lithium cells have a long shelf life there's no way to know quite how long they have been hanging about in some dodgy ebay store.
My 2015 model S never showed a key fob battery warning until this year. We replaced the batteries and checked the voltage (~3.0 volts) but the problem didn't go away. Tech support guided me through two steps:
1. Reset the console display by holding down the two steering wheel thumbwheels. Wait until the display returns to normal.
2. From the Operating menu, choose Safety, then shut down the car. Wait five minutes or so then start the car in the normal way.
I followed those steps and the fob battery low warning has not returned over the past two weeks.
Three cheers for tech support!
No 2 above is akin to a proper 'switch it off and on again' and frankly unless in a rush (or actually driving) I wouldn't bother with No 1 option whenever there are issues.
I've had my 2018 MS 4 years and had to change the fob batteries every 18mths