The motto indeed fits exactly on the theme (c.f. picture below). I also wondered about its origin recently, and I just found two articles in JSTOR (subscription needed), the first has some background which I have pasted below. Hope that helps.
Brahms and Scotland
Roger Fiske
The Musical Times, Vol. 109, No. 1510. (Dec., 1968), pp. 1106-1107+1109-1111.
Stable URL:
https://links.jstor.org/sici?sici=0027-4666%28196812%29109%3A1510%3C1106%3ABAS%3E2.0.CO%3B2-1 Brahms and the Poetic Motto: A Hermeneutic Aid?
Dillon Parmer
The Journal of Musicology, Vol. 15, No. 3. (Summer, 1997), pp. 353-389.
Stable URL:
https://links.jstor.org/sici?sici=0277-9269%28199722%2915%3A3%3C353%3ABATPMA%3E2.0.CO%3B2-E From "Brahms and Scotland":
[...]
In 1892, just 40 years after My Heart's in the
Highlands got into his first piano sonata, Brahms
published three intermezzi as op 117. The first is
headed :
Schlaf sanft, mein Kind, schlaf sanft und schon:
Mich dauert's sehr, dich weinen sehn.
-Schottisch: Aus Herders Volksliedern
These are the opening words of 'Lady Anne Bothwell's
Lament', to be found in Allan Ramsay's Tea-
Table Miscellany (1724) and with a tune in vol 2 of
Orpheus Caledonius. The tune is wide in range,
very hard to sing, and of indifferent quality, and the
song never caught on. Herder found the words in
Percy, who printed only seven verses to Ramsay's 13
and got the refrain wrong. The lines Brahms quoted
are not typical of the poem as a whole. Lady Bothwell
is miserable, and increasingly bitter about the
baby's father. As in Edward, there is a surprise ending;
in the very last line it is revealed that the child is
a bastard. At least it is in Ramsay's version; in
Percy and Herder illegitimacy is no more than
implied. Lady Anne Bothwell has not been identified
with certainty. She may have been the daughter
of the Bishop of Orkney early in the 17th century.
Certainly she had no connection with the Bothwell
loved by Mary Queen of Scots.
For the third time in his career Brahms seems to
have changed into piano music what he began as a
Scottish Volkslied. Once again the words fit; though
in places there is more than one possibility for the
actual notes of the vocal line (see ex 4). The words
are as in Ramsay, with the correct refrain. After a
further eight bars, Brahms has a phrase in octaves
beginning with F flats. Transposed up a 5th and
beginning with C flats, it would make a suitable
piano interlude effecting a return to the opening for
verse 2.
If it be thought that this is speculation run riot,
I am not alone in so erring. In his volume on the
piano music Edwjn Evans mentions 'Lady Anne
Bothwell's Lament', and quotes some of Percy's
words. With great ingenuity he makes Percy's
second verse fit the Piu Adagio section of the
Intermezzo (a singularly unmelodic piece of invention),
and comments on the 'sobbing rhythm' of the
music. There is in fact no mention of sobbing in the
words.
When he began to court my luve,
And with his sugred words to muve,
His faynings fals, and flattering cheire
To me that time did not appeire,
But now I see most cruell, hee
Cares neither for my babe nor mee.
Readers might like to try their hand at fitting these
lines to Brahms's middle section, and they will find
it very hard to do. Even if they succeed, the result
will be a vocal line of such indifference that Brahms
would hardly have fathered it. Yet this is the one
and only time that Evans speculated, as I have been
doing in this article, by putting words against
Brahms's piano music. In my view, only the opening
section of the intermezzo had anything to do with
Lady Anne Bothwell. In his last years Brahms tried
to orchestrate the piece but this middle section
defeated him. Had it really had a melodic basis he
would surely have succeeded.
[...]