Seems like you could test that via negative stimulus. Introduce a negative stimulus like a shock associated with something perceivable by both the caterpillar and butterfly. After conditioning the caterpillar, see if the butterfly shares the same aversion to the stimulus.