The only reasonable way of interpreting this is that, indeed, the caterpillar died, it put itself into a little coffin, and it rotted, it fell apart, but that's very nutritious and out of this nutrition somehow came the butterfly, spontaneous generation and that was what was believed about that. 