But didn't snakes evolve from something with legs? There are a number of snakes, specially historically with legs and some where the leg bones are still there.
Legless lizards and snakes some to convergent evolution. But its of course possible that other legless lizards existed before that.