I’d suspect, and offer, with zero proof, that the fungus has hooked into temperature regulation channels, and ants tend to seek warm/bright, high and dry areas in cold rain, to camp out until they can dead-reckon their way back home if they can’t smell their colony.
Maybe the ant is simply reacting to sensations of cold temperature, and maybe it goes blind, setting off reactions to wander away from the ground, search for bright areas to warm up when in dark unfamiliar tunnels.