In the case of the HPT, as soon as the shaft separates, there is no torque driving the HPC, so it soon quits supplying air to the cycle, and the HPT coasts down.
Of course the timing of the HPC quitting is quite critical, but methinks that the low enertia of the High turbine will be long gone out the side of the engine as it eats the air still left coming out of the combustor