Alright, I am certainly not an expert when it comes to transformation of caterpillars into butterflies but this is very likely a massive and incorrect oversimplification of the process.
I mean this makes it sound like if you poke a hole into the cocoon it will just drip goo out until its empty.
Happy to be corrected by a real expert but very likely transformation occurs in coordinated small steps and not just everything melts and rematerializes.