We discussed this to a little extent
here recently.
The dragons were some kind of fell spirits, maiar corrupted by Melkor I'd think. He didn't create them (as they already existed), only contributed to them having the kind of bodies they had (whether this means that he made them bodies or told them to choose a dragon-like appearance). Thus they weren't dependent on him, and eg. Smaug lived long after Melkor was thrust out the Doors of Night.