I edited my question title to better reflect what I am asking.
I am specifically asking about pedagogical sources that present these three forms of minor scales, like this...
My Piston Harmony textbook (1st ed.) presents such a diagram. My Kostka Tonal Harmony (2nd ed.) does not and explains that in reality there is only one minor scale where the ^6 & ^7 are variable.
So, I'm not looking for an origin to minor key harmony - I already know that from figured bass and the rule of the octave - and I'm not arguing the question of one versus three minor scales - better sources like Kostka explain clearly there is one minor scale.
I want to know - to whatever extent is possible - the origin of the three minor scales concept. Surely this idea came earlier that Walter Piston.
I think of this sort of like the origin of roman numeral analysis which I have seen attributed to Georg Volger and Gottfried Weber. which supplanted the earlier figured bass system for analysis and teaching. One system supplants another and obscures the methods and teaching of the past.
I thought I should add notes about two historic examples that seem to be melodic minor, but are neither named that in the sources nor presented as one of three different minor scales.
The earliest example I know of is Fenaroli's rule of the octave in Regole musicali per i principianti di cembalo.
From the English translation I have seen, Fenaroli didn't apply a special name to this minor scale and he did not distinguish three different minor scales. It is simply the harmonization rule for the minor mode. Note that the middle bass clef is the actual bass, the lower bass clef gives the theoretical root of each chord.
The next oldest example I know is Clementi's Art of Playing on the Piano Forte.
As in the case with Fenaroli, Clementi presents only one minor scale and it isn't given a special name.
The rest of the book goes on to present the scales for daily practice drills in all keys. After than over 100 pages of short performance pieces. Most of those pieces are in major keys. But of those that are in minor keys when the upper tetra chord of a minor scale is played descending in a figure subdividing the beat the raised ^6 & ^7 are frequently employed.
It seems clear from these examples and those I gave earlier from Bach and Mozart that the treatment of the descending upper tetrachord of the minor scale depends greatly on whether the tones are functioning as essential harmony tones or figurative decoration.
While this particular point is interesting it doesn't answer my question.
I've looked at Bach, Mozart, Clementi, and Fenaroli (@KimFierens shared an example from Rameau which on the whole is the same as Fenaroli) but I don't yet have a historic source for the three types of minor scales concept older than Walter Piston.
My original post follows...
The standard textbook description of the melodic minor scale is the natural minor scale descending and natural minor with raised
^7 tone when ascending.
That textbook definition doesn't seem to hold water.
This example to the contrary from Bach's D minor invention is one I easily remember...
...where the circled descending passages maintain the raised
^7 tones clearly because they are essential for the dominant harmony.
It's interesting that immediately after m. 43 the original figure is stated again and the scale descent in m. 45 uses the lowered
^6, but this time, despite the harmony being dominant, the chord is specifically a
vii°7 and so the lowered
Bb is essential to form the diminished 7th chord.
In both cases the inflection of the minor scales seems to be dictated by the harmony not the scale direction.
Other examples can be cited in the two-part inventions. In fact all the minor key ones show descending 'melodic' minor, sometimes in the opening subject material, except when there simply isn't a descending scale passage using ^6 & ^7 (like the A minor invention.) Also, Mozart's Nannerl Notebook shows similar examples. Of course both of these are important historic pedagogical sources. Trying to explain away these as cherry-picked aberrations is a weak argument.
Given the importance of harmony to dictate how the minor scale is inflected it seem especially unfortunate that textbooks use the labels harmonic and melodic minor in a way that doesn't jibe with how the music works.
Equally annoying to me is the explanation that the raised
^6 in melodic minor is used to 'fill the gap'of the augmented second in the harmonic minor. Plenty of examples show that the augmented second was not objectionable in common practice style.
So when and how did this three versions of the minor scale and raised for ascending, lowered for descending concept develop?
It seems clear there is one minor scale and
^7 vary depending on the harmony or a preference for a particular tonal color.
If someone could provide actual pedagogical examples from around Bach's to Mozart's time of how the minor scale/harmony was taught, I would be especially appreciative.