I know enphase micro inverters have "anti-islamding" tech that disables output when they lose grid connection. I would expect any reputable manufacturer to also have the same tech.
I don't expect that for backup generators, but the proper way for them is via a transfer switch. You can wire in a properly made cable instead of a suicide cable. The transfer switch would prevent the inlet connector to the house from ever being live. (And since it is a proper cord from the generator, there would be no exposed ends coming from it.)