A paralysis/behavior modification virus in their DNA.. Nature is scary shit yo....
The Cotesia Glomerata embryos are injected into a caterpillar by their mothers and develop for about 14 days before using a virus in their DNA to paralyse their host. After gnawing their way out using saw-like teeth, they spin cocoons. The caterpillar, still affected by the virus but no longer paralysed, builds a silky blanket over the larvae and defends them from attackers until it starves to death.