A context-dependent induction of natal habitat preference in a generalist herbivorous insect