Everyone involved in the case agreed that Yates was seriously mentally ill when she killed her children. But that is not the same thing as being "insane." Most mentally ill people are not dangerous. And let's leave the term "crazy" out of the discussion, since it's not clear whether it's being used to mean "mentally ill," "legally insane," or "bizarre and outrageous."
"Insanity" is a legal term, with a definition that varies from state to state. The definition in Texas is that insanity = being so severely mentally ill that you don't know that the actions are wrong, which is not an easy legal standard to meet. In this case, the evidence was clear enough that the jury was persuaded that she did not know at the time she killed the children that her actions were wrong. She believed that killing them was necessary to save their souls from Satan.
The analogy with terrorists is a false one. Terrorists engage in criminal behavior, but are not necessarily mentally ill. That is, they don't hallucinate, and they don't have delusional thinking even though their beliefs may be extreme. These people are dangerous, and they are criminal, but they are not necessarily mentally ill in spite of their bizarre actions.
The idea that Yates somehow "got off" is also not correct. She isn't going to take a pill and walk out of jail tomorrow. She will be confined to a locked ward in a mental hospital, and will be required to take medication and participate in whatever treatment her doctors recommend. Essentially she will have no civil rights. It will be up to the judge who tried her case to decide when she may be released. This may not happen for years, and it may not happen at all. If anyone thinks that the "treatment" available to the criminal mentally ill is some kind of picnic, read Pete Earley's recent book "Crazy," in which he describes his journey through the forensic mental health system in Florida as a result of his son's mental illness.