I would not expect a battery to cause this problem.
Try an SMC Reset and a PRAM Reset (hold the PRAM Reset for at least three chimes if possible).
Try running the Apple Diagnostics to see if a hardware issue is detected (doubt it will find one for this specific issue, but if it finds something other than a battery issue, then maybe the things are related).
Sounds like you may have a bad sleep sensor so it will most likely require a repair. Unfortunately Apple won't service a 2013 model as it is now considered "Obsolete". I don't recall whether the sleep sensor on this model is separate from the Logic Board or if it is integrated into the board (or I/O Board). It could also be an issue with the board itself (or the connector on the board)...possibly liquid damage (the most common reason I see this sensor fail while supporting our organization's thousands of Macs). If it is a separate sensor, then disconnecting it from the main board may prevent the problem, but it will also prevent the laptop from waking up when opening the lid (or closing it in your case).