If not, where does the trope first show up and how has it evolved?
This is not exactly what you are looking for, but Don Quixote was published in two parts--ten years apart from each other. In Part II, Don Quixote and the other characters are cognizant of the first volume and the publication of a false second volume. IIRC someone tried to cash in on Cervantes success with Don Quixote by publishing his own version--Cervantes essentially used a dialogue between the characters in Part II to rebuke the fraudulent author.
Again, not completely what you were looking for, but it's a book that has characters cognizant of their fictionality.
Fleischer studios did a series of cartoons with Koko the Clown in the 1920s and he didn't always get along with the animator.
The Spanish writer Unamuno wrote Niebla (Mist in Spanish) in 1907.
In the novel, Augusto, the protagonist discusses with Unamuno about his suicide and his non-existence because he's a literary creation.