The comment by a_paddy is dead and I can't respond to it directly, but all electrical generation and inverters have disconnect switches that monitor for that exact scenario and disconnect in less than 1 cycle (1/60 second). This has been a solved problem for a very long time, yet seems to come up in every forum that discusses home solar.
There is always also someone piling "And also, you have to clean them!" as an argument against solar panels, somehow thinking that 30 seconds with a anti-duster wand is some big drawback.