Native to Australia (where else?) it can also be found as an invasive species in New Zealand. It feeds on Eucalyptus species and can become problematic, striping the leaves and damaging the trees hence it's actual name The Gum Leaf Skeletoniser
As the caterpillar grows it sheds it's exoskeleton, during each molt the head portion of the previous exoskeleton stays attached to it's body resulting in a mini tower of empty heads
“The molted head capsules start stacking early but they are not always visible, as the smaller ones get dislodged over time,” Hochuli said. “It’s not uncommon to see caterpillars with at least five old heads stacked on top of the one they are currently using.” Source
The heads can reach up to 12mm tall, and look rather dandy!
The several reasons for this, one is to look bigger and more intimidating to predators, another is to create a false target for a predator, and another is that the caterpillar uses the head piece as a weapon or shield to fend off insects with needle like mouth parts such as Assassin Bugs
....researchers removed the head stacks from some caterpillars, left them on others, and kept tabs on their survival once they were back in the field. Caterpillars who kept their extra heads were much more likely to survive in the field....Source
Unfortunately for The Mad Hatterpillar it's list of predators is long and relentless.... it has also evolved stinging hairs to complement it's head gear, and will writhe around to evade being grabbed, and if that isn't enough it will vomit out it's guts....
“They’ll just spew out a whole bit of yucky green liquid that probably smells and tastes awful,” Henderson said. “And if they shove that in the face of the predator, it can turn them off.” Source
Once the Mad Hatterpillar is finished eating all the Eucalyptus it can, it pupates into a small brown, unremarkable moth with markings that help it camouflage on the trunks of it's food source
lol, I think they must fall of at some point, presumably when it either spins it's cocoon, or starts to get that crispy covering, it would be quite hardcore if it's wings had a skull type pattern like the Deaths-Head Hawk-moth, though
They are certainly a little bit odd, I didn't know they existed until featuring in one of the science memes recently....and then reading about it vomiting up it's guts etc just adds to it's charm!