Thanks everyone for the replies. Sorry that my OP lacked detail, I didn't realise it was important. Let me answer a few questions...
• I live in the UK.
• I was standing on linolean kitchen tiles wearing leather slippers.
• Humidity is low, I don't like humidity and keep my home well ventilated.
• Initially, I switched off the outlet and unplugged the unit holding just the plug end. I did not get a shock when I did this.
• I only got the shock a moment later when I picked up the charger itself to carry it away. I was holding the charger but may also have made some contact with the battery
• The charger unit is this model:
https://www.ebay.co.uk/p/12009556661
• I've used this charger for over a decade without any problems (with various batteries) so it's unlikely the charger itself is at fault.
• The battery is a replacement battery from a seller of questionable reputation on Amazon. For all I know, it could be very badly made, bootleg, and not conforming to safety protocols. Hypothetically, it could even be a malicious product.
• Sorry if my description of a "nasty shock" was too vague, I didn't think that detail was important. I don't care whether it's harmful or not, I don't want any electric shocks. I would compare it with someone jabbing a needle into my hand. It was painful, shook me up, and my hand hurt for a while after.
• I have no desire to physically troubleshoot this by experimenting with other devices using the same outlet, which is why I came here to ask!
Any more questions, please ask.
If it's impossible for any battery to give a shock then the fault must lie with the outlet, which kind of answers my question I guess.