The thought that reality is illusion might have been with us from the beginning. It certainly goes back as far as the oldest fragments of writing we've found.
From an evolutionary perspective, reflective consciousness has been a blessing and a curse for us. The blessing is its survival value, the curse is awareness of our inner emptiness. We haven't just discovered it. We keep papering over our previous discoveries, so our "rediscovery" of it seems fresh.
The underlying issue is we have thoughts. Labeling some of those thoughts "fiction" (or positing the categories "reality" and "illusion") is just another layer of thought.