I was wondering whether there was a concept of bringing about a perfected world in ancient pagan religions, whether as something the gods were expected to do, something that mankind was expected to do, or a combination of both. I'm wondering specifically about the religions around Mesopotamia, the Levant and North Africa. "Perfect" might have different meanings between cultures, but options might include: A purified world, a world without evil (/evil deities?), world peace, etc. Anything like that?
Norse myth does feature such a belief. See the last seven stanzas of the Vǫluspá or "Sybil's Prophecy," in the Elder or Poetic Edda, or Chapters 52-53 of the "Gylfaginning" section of the Snorra or Prose Edda (scroll forward on this last linked page to p. 82). The Eddas admittedly are not from the Mediterranean region about which you more specifically ask, and Christian missionary influence/contamination arrived in Iceland together with the literacy that allowed Norse myths to assume their earliest surviving written forms. But the motif or belief in question is definitely there.
pagan: a person holding religious beliefs other than those of the main world religions.
Since some of these religions effectively were the main religions at the time (and endured longer than any of the current religions have so far) the term "pagan" is inappropriate. Also, the concept of "evil" or "evil deities" is not necessarily something that was part of the pantheon of these religions.
The Egyptian god Seth for example, is often referred to as an "evil" god by early Egyptologists to mirror the Christian pantheon of good and evil. However, this is not how the Egyptians perceived Seth. As son of Geb (Earth) and Nut (sky), brother of Osiris, Seth was god of the desert, foreign lands, thunderstorms, eclipses, and earthquakes. Seth was a powerful and often frightening deity, however he was also a patron god of the pharaohs, particularly Ramses the Great.
Note that this is not all that different from the origins of Yahweh, who in the polytheistic period preceding monotheism in the Judaic religion also was, according to the oldest biblical literature, a storm-and-warrior deity, who leads the heavenly army against Israel's enemies, and worshipped alongside a variety of Canaanite gods and goddesses, including El, Asherah and Baal.
Mesopotamian, Canaanite and Egyptian gods generally were considered to have good and bad aspects:
I form the light, and create darkness: I make peace, and create evil: I the Lord do all these things. - Isaiah 45:7 (written in the intermediate period between polytheistic and monotheistic Judaism)
or were understood as a necessary balance between opposites, a bit like a Mesopotamian version of Yin and Yang, such as the Egyptian god of chaos, Apophis (who was also the patron god of several pharaohs).
The idea of an evil separate from the "good" god is something that originates in Zoroastrianism and was adapted into later Judaic (mostly apocalyptic) writings and thus into early Christianity. This is also where the concept of the "Last Judgment" comes from. In the original text, the Frashokereti we find the first rendering of a doctrine of a final renovation of the universe, when evil will be destroyed, and everything else will be then in perfect unity with the god Ahura Mazda.