A screwdriver bit set I got years ago from some Chinese web shop had the perfect tools for this: a screwdriver shaft that was thin enough to push the pins, and what appears to be a 2.5mm hex nut driver for the other side. Just pushing the pin into the 2.5mm slot and wiggling for a second or two did the trick. (I don’t know if that’s any standard size, but it was labeled M 2.5 and the opening seems to be approximately 2.5mm. The 3.0mm bit was too large for this purpose.)
Before detaching the connector, you may want to take a photo to remember which way the red and black wires go. Mine were the same way as in this photo, but when looking at the tiny connector of the replacement battery it wasn’t easy to be sure which way to insert it.