@Glennn,
I think I've done this before but I'll try a brief version again.
The actions of God in Job and many other places only make sense in the context of the overarching story of what God is doing. I can't possibly tell you all the reasons and biblical references that support this fundamental drive behind it all so I'll just say it in my own words.
God at some point desperately wanted more company than just his son and the angels he created. Thus was the plan to create 'us'. If we were to be fit company, we would have to be intelligent, self conscious and have free will. We would also eventually have to be free of any outside coercion other that the ideas inherent in our environment.
Very early on, God was challenged by Satan (an angel who rebelled) that given these conditions, all would choose the ideas and ideals that Satan subscribed to rather than God's. Whether this was literal or just the figurative truth inherent in creating free willed beings does not matter. It is the logical reality of free will.
But the imperative with God was that he wanted the company of what men could be if they thrived under those circumstances. The only thing that could stand in God's way of acting lovingly toward man was to be challenged on the 'rules of this existence'. It is that challenge which leads God into the things that you find repellant. They are, but only if you don't see the overarching goal of God.
Even though this has led to situations that made me long for death at times, when I finally got the reality of what was behind it all, I knew I would not have it any other way.