I want to offer an idea up for your consideration, but I feel obliged to forewarn you that this is what theology might call a "hard doctrine". These are the mighty building-blocks of the faith that St Peter warns us about, which can be so, smashy, to the unskilled workman.
It's important to get a good feel for the legal setting. This is a capital case to be decided on points of law. So we will begin by building grounds for an analogy.
Luigi is a murderer, an assassin, a hit man for the mob. He is guilty, he is almost the worst kind of killer there is, and the facts are also quite clear. In a case built on points of fact he is going to be found guilty and punished for his crimes.
But Luigi works for Guido, a mob boss. Guido pays Luigi to kill people, and decides which people, he is the one who has them killed. And he makes a huge profit doing it, too.
Sam is a crusading district attorney. He wants to get Guido, he wants to pursue a higher justice that will best serve the public good. So he is willing to make a deal with Luigi. If Luigi does exactly what Sam says, with full cooperation and good will and no reservations, then instead of being punished for his crimes he is going to get to go and live quietly somewhere reasonably nice with no more big excitement in his life.
In this analogy Luigi represents the sinner, you and me, everyone whose aspirations ever exceeded their computations, each broken imperfect piece of Adam's shattered image. We got it wrong, we did things we can't undo, we deserve what we would get. But, we might, be able, to make, a deal.
Guido represents God, the creator of evil. In the same way that Guido bears the primary responsibility for the crimes committed by Luigi, so also the creator, with foreknowledge, of creatures that would inevitably sin, bears primary responsibility for all sin whatsoever. God may have had a perfectly good reason to do it, some greater good that could be accomlished by "allowing" (creating!) sin. That's fine, Guido also did a lot of good for the community, he also had good reasons to have those men killed, all those men he killed were serial murderers much like himself. He's still Guilty.
Sam represents the church, organized religion, the complex rigmarole we have to sign and seal and go along with in order to make our deal official. We have to cooperate completely, but with our help, they get the one who is really responsible. And execute him. For his crimes.
Jesus closes off the circle in standard doctrine when he starts forgiving sins. How could a person forgive sins that were against someone else other than him? He would have to be the creator to do that, because sin is primarily an offense against God.
The Mystery of the Trinity emerges here in that the creator, bearing primary responsibility for sin, is also its primary victim; and his own just execution can be conceived of as the very pinnacle of murder for which he was convicted.
In short, God did it