Bales made a plea deal. If the prosecution removed the death penalty and only went after life in prison then he would plead guilty. Once the possibility of a death penalty was removed the judge could let him plead guilty.
Not a lawyer but believe that's how it went down.
I guess the same route could be open to Hasan, unless the prosecution insist on the death penalty being kept in.
Bob C