"seeing himself treated in the same way as he'd read that such knights used to be treated in centuries past"

   At this point in the book the balance begins to shift, the world around Don Quixote no longer puncturing but reflecting the content of his delusions - the knight errant's reception in a noble court is a hackneyed scene of chivalric romance, which he gratefully recognises.  Perhaps the earliest example is to be found in the anonymous fourteenth-century verse romance Sir Gawain and the Green Knight (which also coins the phrase 'knight errant') in which the pure-hearted wanderer is guest at the court of an eccentric Lord and Lady.  Gawain resists his hostess' attempts at seduction and eventually realises that the couple are not what they seem, having secretly enmeshed him in an illusory test of his chivalry.  The motives of Quixote's noble hosts are similarly convoluted, although decidedly less benevolent.

 

Online copy of Sir Gawain and the Green Knight translated by K.G.T. Webster and W.A. Neilson (1917)