Caterpillars suffering from bacterial infections often stop moving and become lethargic. The paralytic proteins (cytokines) present in caterpillar hemolymph are involved. The same contractile paralysis that is initiated by paralytic proteins can be induced by injecting bacteria into the hemocoel of caterpillars. (Note the significant contraction in the photo) This has been demonstrated* by comparing injection of bacteria to injection of the paralytic protein. The bacteria trigger the activation of the paralytic protein which affects numerous organs and stimulates nitrous oxide release. Is the paralysis adaptive? The answer is unknown. Immobilization may slow the movement of pathogens and confine their location which may make them easier for the caterpillar immune system to eliminate them. Some pathogens are present on food and paralysis will stop a caterpillar from ingesting addition food that may be contaminated.
*Ishii, K., Hamamoto, H. and Sekimizu, K. (2015), PARALYTIC PEPTIDE: AN INSECT CYTOKINE THAT MEDIATES INNATE IMMUNITY. Arch. Insect Biochem. Physiol., 88: 18–30.