I'm assuming you installed a third party battery since I'm doubtful Apple was still replacing batteries at that time? If this was a third party battery, then the battery could be failing. Unfortunately the quality of third party Lithium batteries is extremely poor even when purchased from a respected vendor. Your best options are from OWC or iFixIt.
FYI, is your battery still under warranty from the manufacturer? Maybe it can be replaced for free under warranty, but it is hard to say what the manufacturer will require as proof of a problem.
Try running Coconut Battery to see how it assess the condition of the battery....hard to say how reliable the assessment is for a third party battery, but it is about all you have to go on here. Also, the health of the battery can fluctuate depending on charge level, so you may want to check its health just before it powers off and as soon as you can log back into macOS after an unexpected shutdown.
You can try an SMC Reset.
You can also try to recalibrate the battery, but I doubt this will help.