This seems to be a mystery. I haven't found any good explanation yet; I don't know if this is because the subject has been neglected so far, or if it's because the very occurrence of the phenomenon is still controversial and so nobody has attempted to give an explanation for it.
The idea that Latin adverbs (and certain other words) were stressed or accented on the last syllable seems to be considered so implausible by modern linguists that no modern linguistic source that I have found has contained either an explanation of why they might have had this stress pattern, or a detailed argument making the case for why they did not have this stress pattern. (I have not read all (or anything close to all) modern linguistic literature about Latin, so it's quite possible that such an explanation or argument exists in some source that I wasn't able to find.) In contrast, I have seen a a number of sources that try to provide detailed analyses of the penult-weight-based stressed rule in terms of modern linguistic theories like Optimality Theory.
Unfortunately, I don't know if the apparently widespread modern rejection of this idea is based on some kind of earlier arguments with more detailed coverage of the evidence for and against.
The types of evidence that I know of, and why they are controversial
Descriptions of Latin accent in ancient grammarians
There are apparently a number of descriptions of Latin accent in ancient grammarians, but sources I have read often suggest that these are unreliable because they may have been overly influenced by the traditional terminology and description of Greek accentuation. For example, they describe a supposed difference between "acute" and "circumflex" accentuation (which I describe in more detail here), but mainstream modern scholarship on Latin rejects the applicability of those terms to Latin accent, which casts a bit of a shadow on anything else that the ancient grammarians have to say about the subject. Concern about the unreliability of these kinds of sources also seems to be part of the reason for the controversy that C. M. Weimer mentioned about the rule that a light syllable was stressed (or according to the traditional account, took an "acute accent") before a monosyllabic enclitic.
Obviously, later accounts of Latin accent are often written by people who were influenced by the ancient grammarians' accounts, so the same suspicion seems to attach to post-classical sources that reference this kind of accentuation.
It might be supposed that ancient poetry could provide some relevant evidence, but the question of how much we can learn about stress/accent from Latin poetry is apparently highly complex and disputed to this day.
So there seems to be relatively little uncontroversial evidence about aspects of Latin stress and prosody beyond the well-known penult-weight-based stress rule.
What is the evidence for this pattern of accentuation?
The Roman Pronunciation of Latin, by Frances E. Lord, contains a relevant Priscian (in fact, it seems to be a "Pseudo-Priscian") quote. (It's from 1894, so I don't know if Lord's statements are outdated.)
Priscian thus defines the accents:
[Keil. v. III. p. 519.] Acutus namque accentus ideo inventus est quod acuat sive elevet syllabam; gravis vero eo quod deprimat aut deponat; circumflexus ideo quod deprimat et acuat.
Then after giving the place of the accent he notes some disturbing influences, which cause exceptions to the general rule:
[Keil. v. III. pp. 519-521.] Tres quidem res accentuum regulas conturbant; distinguendi ratio; pronuntiandi ambiguitas; atque necessitas. . . .
Ratio namque distinguendi legem accentuum saepe conturbat. Siquis pronuntians dicat poné et ergó, quod apud Latinos in ultima syllaba nisi discretionis causa accentus poni non potest: ex hoc est quod diximus poné et ergó. Ideo poné dicimus ne putetur verbum esse imperativi modi, hoc est pōne; ergó ideo dicimus ne putetur conjunctio rationalis, quod est érgo.
Ambiguitas vero pronuntiandi legem accentuum saepe conturbat. Siquis dicat interealoci, qui nescit, alteram partem dicat interea, alteram loci, quod non separatim sed sub uno accentu pronuntiandum est, ne ambiguitatem in sermone faciat.
Necessitas pronuntiationis regulam, corrumpit, ut puta siquis dicat in primis doctus, addat que conjunctionem, dicatque doctusque, ecce in pronuntiatione accentum mutavit, cum non in secunda syllaba, sed in prima, accentum habere debuit.
In the matter of exceptions to the rule that accent does not fall on the ultimate, we find a somewhat wide divergence of opinion among the grammarians. Some of them give numerous exceptions, particularly in the distinguishing of parts of speech, as, for instance, between the same word used as adverb or preposition, as ánte and anté; or between the same form as occurring in nouns and verbs, as réges and regés; and in final syllables contracted or curtailed, as finīt (for finivit).
But since on this point the grammarians do not agree among themselves, either as to number or class of exceptions, or even as to the manner of making them, we may treat this matter as of no great importance
So I would guess the reason this phenomenon is "scarcely mentioned in Latin language classes" is because it seems to be unclear and disputed.
People who are arguing against the idea that the last syllable of an adverb took stress in Latin often seem to reference a passage by Quintilian where he says that, even though some people in his time apparently used an acute accent on the last syllable of the adverb "circum" in order to differentiate it from the noun form, he only hears one accented syllable in his own pronunciation of "circum litora" (by which he presumably means that he said "circum lī́tora"):
I am well aware that certain learned men and some professed teachers of literature, to ensure that certain words may be kept distinct, sometimes place an acute accent on the last syllable, both when they are teaching and in ordinary speech: as, for instance, in the following passage:
quae circus litora, circum piscosos scopulos,
Aen. iv. 254.
 where they make the last syllable of circum acute on the ground that, if that syllable were given the grave accent, it might be thought that they meant circus not circuitus. Similarly when quale is interrogative, they give the final syllable a grave accent, but when using it in a comparison, make it acute. This practice, however, they restrict almost entirely to adverbs and pronouns; in other cases they follow the old usage.  Personally I think that in such phrases as these the circumstances are almost entirely altered by the fact that we join two words together. For when I say circum litora I pronounce the phrase as one word, concealing the fact that it is composed of two, consequently it contains but one acute accent, as though it were a single word.
(Quint. Inst. 1 5, from Quintilian. With an English Translation. Harold Edgeworth Butler. Cambridge. Cambridge, Mass., Harvard University Press; London, William Heinemann, Ltd. 1920. Accessed through Perseus)
And Quintilian's description of the position of the accent in Latin words only mentions monosyllables as an exception to the general rule that the ultima is unaccented in Latin words. (It could be argued though that Quintilian's description was incomplete, since many modern scholars say that ultimate stress may have occurred in words like produc or Samnis.)
It seems the matter has been uncertain for quite some time. Spinoza's Ethica from Manuscript to Print, by Piet Steenbakkers (1994), mentions the orthographic convention of putting a grave accent on the last syllable of certain words that is discussed in Jasper May's answer, and says
Taking a closer look at the arguments adduced for the convention of putting the grave mark differentiae causa, we find that they fall into two groups: there are those who think of it as a merely orthographical phenomenon, and those who think it implies a different pronunciation as well.
Steenbakkers says that Aldus Mantutius's Latin grammar recognizes these words as an exception to the main Latin penult-weight-based stress rule, and suggests that "Manutius apparently derives these ideas from the traditional grammatical authorities: Donatus, Priscian, and Pseudo-Priscian" (p.74). A footnote on the same page elaborates:
Explicit statements to the same effect [as the Priscian passage quoted above] are to be found in Donatus's Ars maior 2.13 (ed. Holtz 1981, 610.11-2) and Priscian's Inst. gram (ed. Hertz 1855-9, GL 2-3), e.g. 'differentiae quoque causa multa solent vel taceri vel contra regulam proferri' (GL 2, 372); other examples: GL 3, 27.4-10; GL 3, 47.4-9. There is a hint of this in Quintilian too [here Steenbakkers quotes a bit of the Quintilian passage mentioned above] (Inst. or. 1.5.25; ed. Winterbottom 1970, 32-3). Statements to the effect that laws of accentuation have exceptions for the sake of distinction can also be found in other grammarians. See, for example, Pompeius, Commentum Artis Donati (ed. Keil 1868, GL 5, 131): 'nam quando dicimus poné [...], non ideo dicimus, quia sic debet dici, sed ut sit discretio. [...] ideo in ultima syllaba inveniuntur accentus.'
Steenbakkers goes on to mention a text from 1586, De recte pronunciatione Latinae Linguae dialogus by Justus Lipsius, that apparently contains a speech/dialogue/lecture attributed to the French humanist Marc Antoine Muret that is critical of the practice of pronouncing these words with stress on the final syllable:
At one point in his lecture Muret sneers at the (apparently quite popular) assumption that the Latin accent can occasionally shift to the final syllable. He criticizes Latin as pronounced in his days:
Cùm enim Serò, Palàm, Doctè efferunt, sic efferunt Seró, Palam, Docté. [...] idq́ue necessarium, vt effatu discernas à Séro, Dócte.
For when they pronounce 'serò', 'palàm', 'doctè', they pronounce it as though it should be 'seró', 'palám', 'docté'. [...] And you must do that, if you want to distinguish them in speech from 'séro' and 'dócte'.
Such a pronunciation is absurd in view of unambiguous statements by ancient grammarians (e.g. Quintilian) that the ultima of a Latin word is never accented. If, on the other hand, the grave denotes the absence of stress, then séro and serò etc. are merely variant spellings for identically pronounced words. Summing up, Muret thinks the habit of putting a grave on the ultima is misguided.
How did this pattern of accentuation originate? (if it was real)
As you say in your question, there seems to be a certain idea that this pattern of accentuation exists to differentiate homophones, which is the kind of explanation that modern linguists tend to regard with skepticism.
I have not seen any attempts to provide a different kind of explanation for this stress pattern, so unfortunately, I don't know how to answer the "why" part of your question with sources.
Therefore, everything that follows from this point on is just speculation,
and the references in the following sections are to literature that is about other topics that I think might possibly be relevant.
Some features of Latin adverbs that seem like they might possibly be relevant
adverbs are "indeclinable": unlike adjectives, substantives, or verbs, they don't end in inflectional suffixes
Adverbs often come immediately before the modified word in Latin. "Latin Word Order" from Rebecca Harrison’s Cogitatorium says
Adverbs do not have endings to indicate agreement, so they are “velcroed” to the word they modify, usually coming directly before.
- adverb : verb/adjective/adverb
- nōn venit
- tam pulchra
- tam celeriter
Some ideas about Latin prosody that seem relevant
According to "Phonological constituents and their movement in Latin", by Brian Agbayani and Chris Golston (2016):
More than a century’s worth of research has established that function words in Latin are prosodically dependent on nearby lexical words ... The combined evidence points to function words forming recursive prosodic words with nearby content words (Selkirk 1996)
Metrical work on where word-stress falls in a line of poetry shows that many function words fuse so closely with the following word that they are positioned within the line as if they were a single word. Thus Frank (1904) finds that strings like sed id ‘but it’, sed amor ‘but love’, sed homines ‘but men’ pattern like two-, three- and four-syllable lexical words do. With trisyllables in particular, Frank shows that function words so closely adhere to what follows that they can take the only accent of the group: séd agit rather than sed ágit ‘but I lead’ and séd erus rather than sed érus ‘but the head of the family’, where the recessive accent expected on the content word shows up on the preceding function word. Frank points out that the same types of combination are often written together in manuscripts: etea for et ea ‘and those’, utipse for ut ipse ‘so that he’.
Allen (Vox Latina, 2nd edition) mentions in passing that in Classical Latin, certain multi-word prosodic units may have been stressed as if they were single words. Two of the specific examples Allen mentions seem to be prosodic units ending in disyllabic verb forms with light penult syllables, where apparently it has been suggested that the verbs may have been pronounced without stress as enclitics (and consequently, a stress would fall on the immediately preceding syllable, which would be the last syllable of the preceding word in the prosodic unit):
Apart from the enclitic combinations, certain other groups of closely connected words were liable to be treated as unities for accentual purposes. We know from the grammarians that certain conjunctions were unaccented, e.g. at, et, sed, igitur (the last in fact probably arose by vowel weakening from agitur in expressions such as quid agitur?). When followed by a noun whose case they governed, prepositions were also subordinated accentually; one consequently finds inscriptional forms such as intabulas, written as a single word; and Plautus and Terence show evidence for enclitic accentuations of the type apúd me, patér mi. The same seems also to have applied to idiomatically as well as grammatically connected words, such as morém gerit, operám dare; but we have only partial knowledge of such phenomena, and are largely dependent on not always clear
Based on these quotes, I wonder if the supposed stress on the last syllable of adverbs might be connected to possible lack of stress on the following word; for example, in phrases where an adverb was followed by a disyllabic word with a light initial syllable that lost its accent and was pronounced as an enclitic?
For example, the Lewis and Short entry for pone mentions the example "Pone petunt, exim referunt ad pectora tonsas"; from Ennius; if the first part of this was pronounced as /poːˈnepetunt/, it would have the stress pattern that would be regular for a single word according to the Classical Latin penult-weight-based stress rule.
A serious problem with my suggestion here is that it would only explain this stress pattern in very particular phonological environments.
Earlier on the same page, Allen does mention the possiblity of enclitic accentual changes leading via analogy to the development of special stress rules that conflict with the main weight-based rule:
One cannot ... exclude the possibility of an analogical accentuation of the type bonắque after the pattern of bonúsque, etc. Priscian specifically mentions such an analogy in the case of the fused compounds utrắque, plerắque, after utérque, plerúsque (K. ii, 181: 'communis trium uult esse generum'). But it is doubtful whether these analogies apply to the classical period.
However, I think it seems pretty far-fetched to suppose that sequences of adverb + iambic verb form were so common in Latin as to provide the basis for analogical extension of word-final stress to adverbs in general, in any position.
The idea that iambic verb forms in Classical Latin could be pronounced enclitic to the preceding word also seems to rest on fairly doubtful evidence.
One issue with the kind of "metrical" evidence that Agbayani & Golston and Allen allude to is that apparently there is apparently still little consensus about how Latin stress accent related to meter. Language and Rhythm in Plautus: Synchronic and Diachronic Studies, by Benjamin W. Fortson IV (2008), says
One metrical phenomenon that has historically been used to investigate the phrasal articulation of Latin speech is the verse ictus, the beat of the line. There is great disagreement about its nature and whether there even was such a thing in Plautine poetry at all.
Fortson also has a section about verbs where he says that there was probably no tendency to pronounce iambic verbs as enclitics after other iambic words:
a sequence of iambic word followed by iambic verb (the type pater petit) barely ever fills a measure of Plautine verse, as discussed in Ch. 3, which indicates rather strongly that such a sequence was not prosodically equivalent to a four-syllable word of the same metrical shape, and that therefore the verb did not cliticize to the preceding word.
Unfortunately, I wasn't able to find much discussion of the prosodic behavior of adverbs in Fortson.
I want to emphasize the uncertainty of this answer: it's really just something that I've been wondering about, and I think it has some information that may be relevant, but I don't think it is at all an adequate answer to the question posed. I hope someone will post a more complete answer in the future. (I'd prefer not to have this answer accepted, as I may want to delete it in the future if I discover something further that reveals that the information here is irrelevant.)