This "one-too-far" figure has its roots in 17th century improvised embellishment practices. Here is a simple example adapted from my van Eyck series on this blog: link. The upper staff is the ending of the original tune ("Wel Jan wat drommel"), the lower staff the equivalent place in the first variation. The escape tone diminutions are circled. The last of them is not quite a diminution, as van Eyck actually reorders the notes of the original, but the effect is pretty much the same.
In tonal music of the major-minor system, the most familiar—and probably most influential—figure of this type involves scale degree ^6. In example (a) below, the motion from the consonant A through a passing tone G to a consonant F# is embellished with an escape tone B. This is rather mild business, of course, as the B is consonant with the pedal base D. Even in my rather Brahmsian version, with its third and octave doublings, the effect is sweet rather than dissonant. In example (b1) the underlying voice leading pattern is shown, this time with a change of bass, however. It's this version—embellishment of V rather than I—that is commonly found throughout the century from roughly 1770 to 1870—see example (b2) for the figure with escape tone. Examples (c1) and (c2), then, show two versions with full harmonies.
The escape tone figure was one of the most important enablers of the dominant ninth chord. All it took—as Schubert and others in his generation discovered—was to replace the passing motion with a neighbor figure by resolving ^6 back into ^5 over the chord change.