Here's my theory, by gathering Nature Chakra while under a Genjutsu you can use the incoming chakra to cancel the Genjutsu, impossible to notice(except the concentration needed for Nature Chakra gathering) and therefore a bulletproof way to get out of a genjutsu as long as you have time.
Genjutsu is when a person uses their chakra to create a disturbance in another persons chakra. The person who is under the effect of the Genjutsu might be standing still while being showed and imagining horrible things, such as people dying, intense pain to mention just a few and so they either break down or the Genjutsu caster can use the time to attack. Or the Genjutsu can make the person(s) affected by it run around into a trap, over a cliff, to mention a few, usually by creating a illusion to guide them in the wrong direction.
Those most suitable for Genjutsu, both casting an interrupting are those with high intelligence or/and an eye for details. But there are several ways to break out of an Genjutsu. There is Pain, another person pumping chakra in to the one under the Genjutsu to counter it, doing a Genjutsu release by your own, or by unknown means train your eye(s) to withstand Genjutsu. So the most important thing to notice here is that it's all about using a stronger force to break the Genjutsu.
Sage Mode, is when you absorb the Nature Chakra which is all around in the air and ground. The basis of gathering Nature Chakra lays in standing still. When you are under a Genjutsu as preciously said, you are either fooled to run around, or under the illusion that things are happening to you, but in reality you are standing still. So unlike what I said earlier it's not a bulletproof way as long as you can stand still, but once you know your under, it's bulletproof.
When you gather the Nature Chakra only you will know about, if we assume your Naruto and are among the few people who can, or the only one atm as far as we know. By using that Chakra that you are gathering you can easily block or interrupt the disturbed flow of chakra that is causing the Genjutsu.
As long as you have the time you can do it.