I've recently read a very interesting study about recursive controlling behaviour in social insects.
Basically social insects like bees, wasps and ants do not only just need to know which task they have to do at a given time, they also need to know how good they are at a given task.
Not all insects in a colony are equal, in fact they often are very different. Some are more bold, some are better carriers than others, some excel at navigation in complex environments, some are better at rearing brood or regulating nest temperature.
An ant with poor navigation wandering off into the great unknown might not find back home and become a dead ant very quickly. Not bad if it happens once but if it's a regular thing that's a problem.
The study concluded eusocial insect workers do in fact have a pretty good idea about their strengths and weaknesses and so far scientists have no idea how they're doing it.
They must have either some form of self-awareness that requires very advanced neural processing or they have a very sophisticated trick we have not even begun to understand.
Do you have a link to the study? I'd like to read it.