There are some wasp and fly species that lay their eggs INSIDE the caterpillar's body. The eggs hatch and the (wasp/fly) larvae feed on the guts of the cat while still alive. Then the cocoons of the wasp/fly "pop" out along the backs and sides. In your case it sounds as though the larvae emerged directly from the cat body. it is an extremely sad and disturbing thing to witness. On the one hand, this is nature's way of keeping things in check, but some of the these predators have been introduced either intentionally as a bio-control or unintentionally simply thru our (human) global movements. The Compsilura concinnata fly was introduced to control gypsy moth, but has become a serious threat to our native wild silk moths.
In some species, the parasitic wasp/fly is very specific to its "host" (the cat). What species was the cat? luna? cecropia? polyphemus? Where do you live and do you still have the larvae (squirmy yellow thing)? I ask b/c I know someone who does research ion certain species and he may be interested. Nature is certainly interesting, huh??
lele