If rain blows up under the tank and kills the ignition, sitting a couple of minutes will stop more water from getting in there and the engine heat will dry it out, giving a reset effect.
Take a close look at the wiring where it goes into the headlight. If the insulation is worn, water could cause some high resistance short term shorting that can kill the engine without blowing a fuse.
There is a rollover valve in the tank vent hose. If by some chance, the tank gets overfilled, it is possible for enough gas to overflow into the hose to force the valve shut. Loosen the cap when the bike starts to die. If it fixes the problem, either the hose is pinched or the rollover valve is blocked.
It's a longshot but, if all else fails, check the battery ground cable at the frame end. Water doesn't conduct electricity as well as a good solid metal on metal connection and it could insulate the ground enough to kill the engine.