Today I had a realization about why Ballas had Margulis executed. Now I want to make it clear, I'm not excusing it or anything of the sort, I simply want to explain what I think was his mentality was behind it.
While it was clear that their relationship had a falling out for awhile, what her actions were following the Old Peace was clearly the tipping point of things. Margulis, while wanting to protect the tenno from the results of Ballas's machinations in sabotaging the old peace, decided to erase their memories and take the fall for it instead. But it wasn't twarting his plans that did it. In his descendia dialogue, Roathe states that to the orokin, memories were sacred and that is what's fueling his hatred of Albrecht. He (believes) that Albrecht erased his very self when taking away his memories, something the orokin take very seriously.
But that's also what Margulis did to the tenno. Just about everyone can agree that what Margulis did was kind of fucked up even if she had good intentions and a notable reason for doing so. But to the orokin what she did wasn't just "kind of fucked up." Margulis took away from the tenno something which the orokin, and by extent, Ballas, take to be sacred. To Ballas, Margilus wasn't just protecting her little nightmares or betraying him (though that also mattered of course); To Ballas, and all of the other orokin, Margilus was also committing sacrilege of the highest order.