For example, I know the Bible talks about the Assyrians and Babylonians - but those were the Neo-Assyrian and Neo-Babylonian empires, thousands of years after the height of the Sumerians and Akkadians. Was any memory of the earliest Mesopotamian cultures preserved, particularly after cuneiform text ceased to be used? (I've heard c. 100 CE for that?) Or were they a completely new re-discovery in modern times?
Classical tradition preserve a list of traditional empires that exerced hegemony, the list was extended trough time. The first greek version is found in herodotus with the succession Assyria-Media-Persia with the addition of the macedonians ( propably by Demetrios of Phalerum) and then the romans (by Aemilius Sura after the victory over the seleucid Antiochus III), this list was then quoted by many autors, most of those lists started with Assyria as the first world empire. For sumer, I have read that the last copy of the Gilgamesh epic is dated around the IInd century BC, and was still written in akkadian.
Some greek authors also preserved legends about assyrian kings, but those are mostly legendary, like Semiramis who was supposed to have conquered india (this legend influenced Alexander when he took the decision to go through the Gedrosian desert to do better than the assyrian queen)
It is true that the Classical tradition preserved a version of a sequence of empires, but that sequence is hopelessly muddled, often entirely incorrect, and frequently entirely wrong. For example, the Median Empire seems to have been an invention of Herodotus (or perhaps more precisely, a misunderstanding of him or his sources)--there seem to have been multiple Median kingdoms and chiefdoms, but nothing like an "Empire" that ruled Mesopotamia. The version of Mesopotamian history found there is actually fairly incoherent, and matches rather poorly with Mesopotamian sources. perhaps more notably, it really only begins with the Neo-Assyrian Empire, with little mention of the complex Late Bronze Age political situation, let alone the much earlier period of Akkad and Sumeria. The Old Testament is in much the same way in terms of chronology and is broadly speaking uninterested in documenting the details of the Mesopotamian kingdoms, but is understandably more accurate. It is very difficult to know what the situation was like in Mesopotamia itself pre-Islamic Conquest, however.
So to my knowledge, before the 19th century, people had a sense of the immense antiquity of Babylon and Assyria, but the information was either muddled and inaccurate (in Herodotus' case) or fairly incomplete (in the case of the OT) and didn't really extend to before the Neo-Assyrian Empire. The rediscovery of Sumeria I believe more or less entirely had to wait for the work of archaeologists and translators such as Austen Henry Layard.
Source is the Oxford Companion to Archaeology (ed Brian Fagan).