WARNING (reader discretion is advised. Don't do these experiments if you are not familiar with existential philosophy or if you suffer from some mental disorder)
This question is subtle. I think thought experiments are the best way to pose it. (I'm sorry they sound too Sci-fi and they are too long).
Thought Experiment 1: Virtual Reality for Cows.
Let's presume that it's discovered that cows that live with no stress and good conditions produced better meat and milk. Breeding cows in an open farm can be very expensive so a new way of raising them is invented which is by virtual reality. Those cows would believe that they are in the Alps or similar place with no threats nor fear of predators in a loving atmosphere when in fact they are living in a slaughterhouse.
How ethical would that be? What's wrong with having "happy meat" at a low cost?
Thought Experiment 2: Human Farm.
Let's presume a much more advanced alien civilization had created a Matrix-Style world for us to produce some type of "milk". That "milk" is some sort of energy that is produced by human suffering. When we die they need our consent to make us reincarnate into a new body. They examine our thoughts and feelings to manipulate us using an AI machine. Guilt, remorse, past relatives, spiritual figures, past traumas, etc. are used for this purpose. This alien species know more about our psychology and nature than ourselves, they know all our thoughts and memories we have had and they can travel in time so they would always know how to trick us into going back into this virtual-material world over and over again.
This idea of an Evil God creating this reality has been believed by different kinds of Christian sects such us the Gnostics (who believed in salvation through knowledge) or the Cathars(who practised asceticism in order to reject this material world created by Satan).
Thought Experiment 3: Prison planet or purgatory
Let's imagine that in the future chaos and corruption almost killed the entire humanity because of this human trend to selfishness, evil and corruption. As humans are immortal because of the new discoveries in genetics, Psychologists of the future would say that the best way to change a person is to erase his memories temporarily and create a virtual world to re-educate the person into somebody suitable for the society of the future. All your thoughts and actions will be recorded and a jury will determine if you could fit into this future society called "heaven".
This idea is also shared by many New Age sects.
In Hinduism Brahma is the creator of Maya (this present fake world of illusion). In Buddhism the same concept applies. In the Judeo-Christian tradition God banned Adam and Eve from heaven because they ate from the tree of knowledge. If God is all wise and created man, woman and the lying snake with all their flaws and God is all omniscient (past, present and future) then God knew they both would bite the apple. Then God banned them from heaven and fooled them with the idea of "free will" and made them guilty of "original sin" which is a morality rule created by God itself.
In Greek mythology you have the example of Prometheus who was punished by Zeus because he helped humanity by giving them the knowledge of fire.
How ethical would be to create a fake world for purposes that are ignored to us? If another human created a virtual world we all live in could we call that human "God"? Perhaps ignorance is a painful part of the existence we may have trouble dealing with therefore we create very well developed fantasies (sometimes comforting sometimes not) called religions which provide us with meaning and purpose. Maybe we believe them because they suit the way we feel or because we were indoctrinated to. Perhaps hope in a better world after this life is needed for emotional reasons like a slave who needs to believe that he will be free.
Perhaps God is nothing but the projection of a "psychological father" that presumably acts in our best interest as if we were children not mature enough to understand his motives. Or maybe we don't ponder too much on this because we don't want to see our illusions destroyed as Nietzsche would say or we could end up hating our creator if we knew the truth therefore it's better just to have "good faith"?
I'm looking for authors, books, films etc. who talk about this.
“God is subtle but he is not malicious.”
"I have second thoughts. Maybe God is malicious." Albert Einstein