Daniel 9 is not about the messianic age. It is not a messianic prophecy. And, "no," "the" messiah did not have to arrive before the destruction of the second Temple.
Daniel is seeing a vision about the return of the Jews from the exile in Babylon. In his vision he sees that a messiah (not "the") will give the word to rebuild Jerusalem. The word "messiah" in Hebrew means "anointed one" and it is used to speak of anointed kings and Jewish priests.
In Daniel 9 the first ruler (messiah) comes after 49 years after the destruction of the Temple a ruler will come and give the order to rebuild Jerusalem:
"Know and comprehend: From the emergence of the word to return and to build Jerusalem until the anointment of the prince will be seven septets, and fir sixty-two shavuim (weeks / septets) it will be rebuilt, street and moat but in troubled times." Daniel 9:25.
The messiah is Cyrus the Great of Persia. He was the king who gave the order to rebuild Jerusalem. From the time the order is given the Jews have nearly 500 years to return to observance and avoid a second exile. If they do, then they will avoid a second exile. (All negative prophecies are warnings that can be averted if one listens to the warning). Missionaries will claim that it was not Cyrus who gave the word mentioned in Daniel 9, but the prophet Ezra tells us:
"And in the first year of Cyrus king of Persia, that the word of the HaShem by the mouth of Jeremiah might be fulfilled, the HaShem stirred up the spirit of Cyrus king of Persia, so that he issued a proclamation throughout all his kingdom, and put it also in writing." Ezra 1:1
In case you were not sure that it this word was fulfilled by Cyrus, we can recap all of the above verses with this synopsis in Chronicles.
"To fulfill the word of HaShem by the mouth of Jeremiah, until the land had enjoyed her Sabbaths; for as long as she lay desolate she kept Sabbath, to fulfill seventy years. And in the first year of Cyrus king of Persia, so that the word of HaShem spoken by the mouth of Jeremiah might be accomplished, HaShem stirred up the spirit of Cyrus king of Persia, and he made a proclamation throughout all his kingdom, and put it also in writing, saying: Thus said Cyrus king of Persia, All the kingdoms of the earth has the HaShem G-d of heaven given me; and He has charged me to build Him a house in Jerusalem, which is in Judah. Whoever is among you of all his people, HaShem his G-d be with him, and let him go up!" 2nd Chronicles 36:21-23.
This indeed happened -- just as Daniel had been told. Cyrus gave the decree to rebuild Jerusalem.
"Know and comprehend: From the emergence of the word to return and to build Jerusalem until the anointment of the prince will be seven shavuim (weeks / septets), and for sixty-two shavuim (weeks / septets) it will be rebuilt, street and moat but in troubled times." Daniel 9:25.
For 490 years (from when the first Temple was destroyed to the destruction of the second Temple) the Jews need to be purified of their sins such as not properly observing the sabbatical years. The angel says the second Temple period will be troubled.
All negative visions can be avoided. If the people used the time correctly they can receive the positive vision mentioned in Daniel 9:24 "to terminate transgression, to end sin, to wipe away iniquity, to bring everlasting righteousness, to confirm the visions and prophets and to anoint the Holy of Holies." If they do not turn away from their transgressions and stop doing the evil things moving them away from Torah they will have a different ending -- and a second (and evil) messiah will come to destroy Jerusalem yet again, and exile the Jews again as well.
The Jews did not heed the warning — indeed the Second Temple period was one of great strife. The Jews actually invited the Romans in! Some Jews became very Hellenized (Romanized). There were many splinter groups, one of whom actually torched the food within the walls of Jerusalem — destroying their fellow Jews. The Talmud (Yoma 9b) says: “Why was the Second Temple destroyed? Because of sinat chinam, senseless hatred of one Jew for another.”
Hence the second exile was not avoided. The Temple was destroyed in 68 CE and around 135 CE the Jews were exiled from Judah — most of us for 2000 years.
"Then, after the sixty-two septets , the anointed one will be cut off and will exist no longer; the people of the prince will come and will destroy the city and the Sanctuary; but his end will be (to be swept away as) in a flood. Then, until the end of the war, desolation is decreed." Daniel 9:26.
The term “messiah” is used 39 times in the T’nach. It means “anointed one” and it refers to kings and priests. In the case of Cyrus it refers to a non-Jewish king. The evil messiah who is cut off from G-d at the end of the 490 years (as mentioned in Daniel 9:26) could have been Herod Agrippa, or even Titus (who became the anointed emperor of Rome). How do we know this second messiah was evil? Because Daniel tells us that he will be כרת / kareit -- cut off. The term כרת / kareit means someone who has done something so evil that he is cut off from G-d and from the Jewish people. Missionaries who wish to insist that Daniel 9 is speaking of Jesus (as at least one of the messiahs) should ask themselves "was Jesus so evil that G-d would have cut him off from knowing Him?" If not, Daniel 9:26 cannot be speaking of Jesus.
When Daniel 9 uses the term "messiah" there is no definite article (the word "the") used at all, even though some Christain translations including the King James Version say "the messiah."
The lack of a definitive article (messiah but not “the” messiah) indicates that this second anointed one (messiah) could refer to several different anointed subjects. King Herod Agrippa the last King of Judah (Kings are considered anointed as it says in 1 Chronicles 11:3). He was killed during this time (around 44 CE). Messiah could also refer to the last High priest (priests are anointed as seen in Vayikra / Leviticus 4). There was also Titus (Emperor) who made a treaty with the Jewish nation for seven years, but for the second half of the term the Romans would violate that covenant and impede the Temple service. He eventually became the Roman emperor and died around 81 CE.
My point being Daniel 9 has nothing to do with “the” messiah or the messianic age. David was a messiah. Aaron was a messiah. Saul was a messiah. Cyrus was a messiah. Solomon was a messiah. . . none of them were “the” messiah. There are two messiahs (plural) in Daniel 9 -- neither of which was "the" messiah. This is not a messianic prophecy. (Actually the book of Daniel is not prophecy at all -- it is found in Ketuvim, Writings, in the T'nach). To better understand why Sefer Daniel is not prophecy refer to the 365 Prophecies tab and read the post explaining prophecy. Link.