Anecdata: Happened to me with my last two phones, Nexus 6P and Pixel XL.
Unethical LPT: Always buy the extended 'protection plan' since this problem happens so reliably around the two year mark. Call complaining that your phone crashes when it's low on battery and get a new phone for like $100. Cheapest way to get 4-5 years out of a single phone purchase.
And since it's been two years since you bought the device they'll almost always give you a better phone as a replacement.
In Apple land all you’re getting is a battery replacement. Definitely no upgrades either. Not worth $100, as aftermarket battery replacements are cheaper, and you’re out of warranty anyway..
Except, no, it doesn't.