There is a great deal of prior art, but it's not as simple as it sounds.
To summarize the problem with the most basic version of the idea: If the AI expects higher reward from the shutdown regime, it will deliberately cause a malignant state. And if the AI expects higher reward from the non-shutdown regime, it will fool the malignancy-detectors or subvert the tripwires. (It is not realistic to assume that it would be impossible to do so.)