That is what happens to any caterpillar unlucky enough to become the nest for an egg laid by a caterpillar wasp. The egg then hatches into a larva that consumes its landlord. Remarkably, some plants have evolved a way to use caterpillar wasps to defend them from attack by hungry wrigglers. Like a silent scream or a chemical distress signal, the terpenoids warn the wasps that caterpillars are nearby. The wasps then flock to the plant, laying eggs on the vulnerable caterpillars.
Some wasps get a little help from a special virus in protecting their newly laid eggs.
It prevents the caterpillar's immune system from attacking the egg. In return, the wasp supports the virus by providing a host. The only loser in the arrangement is the hapless caterpillar. Other caterpillar wasps target caterpillar eggs, not the worms themselves, for egg laying. The Trichogramma larvae then feast on the caterpillar eggs.