Same thing happened to me with my 2012 MacBook Pro. I had the battery replaced and have not had an issue since. The problem did not start until 2016. So it was good 4 years before my battery had issues.
I am having the same problem as of earlier this week. Mine has died each time it gets around 35%. Coconut Battery reports 267 cycles and 83% health. Guess I will be looking into a battery replacement.
I have a 2015 15", pushing pretty close to 900 cycles, my battery is at 80% capacity and will die at 30% if the amd gpu is used, otherwise it will drain normally beyond that. But the second I do anything that uses the amd gpu, night night laptop.
Sadly my macbook isn't within the serial numbers for a free battery