Various ant species do a similar thing where their soldiers have really big, flat heads and when their nest gets attacked, the soldiers stick their head into the entrance way, so the attackers can't come inside.
Apparently, this kind of behaviour is referred to as phragmosis.