I don't see how leaving parts behind would make a difference. If the larva has learned some behaviour, then this information would be stored in memory. Even if the brain of the larva remained intact and were re-used in the adult, presumably the digestion of the body would result in brain death since there would be no oxygen or nourishment supplied to the brain tissues once the larval body had been destroyed.
--
moto