I remember the first time I witnessed that in person. It must have been the late 80s/early 90s, I was trying to catch lizards on a dilapidated house next to my mémé's house in France. I finally caught one + the next thing I knew, it was running away + it's tail was still in my hands. That shit me up, haha!
It happened again, years later, when I was renovating a barn (again, in France), it grossed me out. I still hadn't grown out of catching lizards (they're so bloody cute!)!
Lizards can regrow body parts that get detached through fighting or like you experienced.