The official theological answer is that Allah wants to see who's the best among us.
Allah sees if our will can withstand the attacks of the 21st century. This is not a competition. We are all on the path of betterment.
God does not need our obedience and worship, because God has no needs -
"And I did not create the jinn and mankind except to worship Me" (Qur'an 51:56).
Allah created us so we can worship him, but more integral through our worship and and focus on his divinity are we forming a relationship with Allah, our creator. Allah is the only being in this grey world that yearns a relationship with his creation, that loves and forgives us for our falsehoods.
And Allah doesn't need anything, but through the connection we are building up to the creator we achieve more divine enlightenment. This is the end goal. Greater understanding. The black-pill is a form of greater understanding as well, just as an example.
In Islam the concept of the life is a test is strong. "Do not think that you will enter Paradise until you have been tested like those before you" (Qur'an 2:214).
Allah doesn't test us for entertainment. He tests our hearts. Allah doesn't command us because he feels a way, he commands us so we achieve the state that allows us to enter paradise.
"And whoever does good, whether male or female, while he is a believer - those will enter Paradise" (Qur'an 4:124).
Ibrahims willingness to sacrifice his most priced belonging shows his dedication to Allah. Allah tested his boundaries and Ibrahim passed. This is very rewarding for Ibrahim. He has proven to himself that he isn't a hypocrite, but a man who holds his word. Faith builds character.
I'm not an Islamic scholar or an Islamist, nor do I try to be, Christianity and Islam are both paths that lead to God in my view. In Islam Christians are Ahl al-Kitab, people of the scripture. We worship the same God, so there is no bad blood, my friend.