Well the charger routes the current through it's chip, and other electronic components. A circuit made of loose change is a dead short. No resistance for the battery to push through, so it just feeds right back into the battery. Li-ion batteries can't work with a circuit like that, so they overheat and do naughty things.
And yeah, you were very lucky. These aren't the old AA, AAA, C, and D batteries that never go nuclear.