Repurposing of musical passages — especially repeating a passage modified with a different continuation — was useful efficiency in the writing of music to be read by amateurs in the living room. Those same ways of constructing phrases pose memory puzzles for the professional player delivering the music in a public concert.
Scripts of old plays were memorized by actors, making use of all the considerable techniques of the memory arts of the pre-technology epoch. What I often call “musical scripts” of 18th- and 19th-century piano music were more likely meant for easy reading at sight.
The exact little twists and turns that may perplex the modern memory player (that are only even fully noticed or untangled by the memory player), are passages that are reused with slight modifications that pervade the musical products, the piano compositions, of the 19th century.
Robert Schumann: Opus 111, Number 2