Contain first, analyse later
The moment the encryption stage (T1486) is detected behaviourally, the responsible process is suspended and the spread is stopped.
The suspended process is not terminated; it is preserved as-is for forensic analysis. The way to decrypt the files is often inside that very process.