Actually, the writers of both films stole the idea from Philip K. Dick. He spoke and wrote about the idea of a simulated fake world long before either of these films.
Hollywood has stolen a lot from PKD
He himself never received much money from any of his works except Do Androids Dream… at the end of his life