But why undertake this elaborate millinery? One study published in 2016 investigated this question by holding trials involving the caterpillars and their natural predators — spiders and stink bugs. The researchers found that attacks on larvae with a stack of headcases took more than 10 times longer than attacks on larvae that had had their stack removed. They found that the empty head capsules acted as a false target for predators and could also be used to deflect the piercing rostrum of a predator.
https://www.livescience.com/animals/moths/gum-leaf-skeletonizer-the-venomous-mad-hatterpillar-that-wears-its-old-heads-like-a-crown
Oh really cool, thank you!