Let's say for argument's sake I was to create a living robot that was perfect. It was absolutely flawless in it's design, and function. However, I decided to give my artificial creation a choice. Either to remain perfect, or break it's original code and become defective.
If then my robot decided to become defective, should I blame the robot for giving it a choice that I programmed it to have.
Yes, or no?
Your analogy to a robot would be better if you gave the robot the ability to correct its mistakes; but the robot still couldn't love you.
Could anyone program a robot to love him? We read that God is love. God made man so He could love him. Love between two different levels of life depends on how far apart they are. You could love inanimate things but they can't love you back at all. You might love plants. I don't know if they can love although they're alive. You can love animals and the closer they are in awareness to you, the more you can love them and hope to have them love you back. If you're lucky enough to find someone to love and who returns your love, that is the highest expression of love without God in the equation.
So looking at how love works, we can see that God wanted to make man as close as possible to Himself. Love required it. Man therefore had to be given a choice because love is always voluntary -- never programmed, never forced.
God had to make man with the power to make a choice. God decided to love, then the question was and still is if men and women love Him? God made His choice. He will love people even if they don't love Him back. Love is risky. God took a gamble. Love must take that gamble.
God's Wisdom took into account what might happen if man made the wrong choice. God had an answer before that problem arose. There would have to be a way to correct mistakes man made so his mistakes weren't eternally disastrous. God had the idea of repentance and forgiveness in mind before He made man. Man can, at any time, realize the error of his way and turn around in repentance. Even in the deepest depravity, someone can change course by giving up love-of-self only as a road to disaster and choose love.
I read something once (and I don't know how seriously to take it) but the author said after making man, God told the angels He would like them to help Him. Most of the angels agreed knowing that they would suffer when man made the wrong decisions; but some said they didn't like the idea of suffering for others, and these became the fallen angels.
God risked a lot. God suffers when His children hate and hurt each other. He suffers because He wants us to be happy. The Father was suffering then, and His Son was suffering; and when the Son saw his Father's suffering and man's suffering, he wanted to end it if he could. Life would be unbearable even in Heaven under those conditions. Indeed if God did nothing about it, He would have ceased being God since God is Love. That could not be. When the world was ready and able to receive Heaven's solution to the problem, Jesus came.
Note the Father could not dictate to Jesus that he had to lay down his life. Jesus had to choose it or it wouldn't have been love.