Actually the Matrix was based more on this book of philosophy. Wish I could remember it now
I think you're talking the book by a Chinese philosopher(BC 365 - 293). I only know his name, and the name of the book only in my language which is different in English. Anyway, one of the line from the book was quoted in the movie. It's the line about the butterfly, and the dream. That theory has been widely used in so-called cyberpunk works, especially in Japanese animations.
Here's the very brief, brief, and brief timeline of this genre.
In BC 365, This Chinese philosopher came out with the idea of "the world we live in", "what's real?" "Who am I"...etc.
In 1959, SF writer Phillp K. Dick came out with "Time Out of Joint" which started(well, not really.) this specific cyperpunk genre.
In 60s, Japanese Animation started to focus on this cyberpunk genre.
In 1982, "Blade runner" developed this cyberpunk genre further.
In 1995, "Ghost in the shell (based on the comic book by Masamune. The animation only took 3 parts of the whole comic book) came out .
Then as we all know, Matrix came out, heavily based on the "Ghost in the shell".
Oh, I forgot to mention "Total recall" which could've been a killer SF movie, if the director didn't screwed it all up.