Galdós was born the same year as Henry James. His Amigo Manso begins by saying "Yo no existo" [and I don't exist] and explaining that he is a fictional character. James will never break a fictional level in this way, but he will write metafiction of another type ("The Figure in the Carpet").
Unamuno's Niebla stages the conflict between author and character in explicit terms. He is anxious to say he has chronological precedence over Pirandello. Niebla has a plot similar to El amigo Manso: an ineffectual man falls in love with a woman who marries someone else. Both protagonists die of sadness after suffering indigestion.
Cervantes is behind all of this. In the anglophone world it might be Sterne, but Unamuno, Borges, are always thinking of Cervantes (Galdós too, probably). Unamuno shares the same first name, and is constantly playing with Descartes, Shakespeare ("to be or not to be"), and Cervantes, who writes the dedicatory sonnets in the prologue to the Quijote in the voice of characters from the books Don Q liked to read. Borges chooses this to be the book Menard re-writes, not because it has dull platitudes about "las armas y las letras," but because of this metafictional dimension.
Borges loved tales of action and adventure, but for various reasons he was unsuited to that life. Many of his works, including "Pierre Menard," echo the locus classicus of "las armas y las letras." So this topos does have a metafictional dimension too: the bookish sort imagines battles, but from the comfort of his own library. Cervantes, wounded in war, puts the speech about the superiority of arms over letters in the mouth of a fictional character. One can believe that he really believed that the life of war is superior to writing books. In Borges, this has to become ironical. A man of Menard's generation cannot express these views with a straight face. Menard, a devoté of Paul Valéry and of chess, is Borges's alter ego.
"El sur" is also about arms and letters. The narrator-protagonist is bookish sort. After an accident on the staircase, after buying a rare book, he goes to recuperate in the countryside, and is confronted by a gaucho who provokes him into a knife fight out of Martín Fierro.