It must be Messianic. I am not going to comment on verses 21 and 22. But verse 23 seems to be a reversal of the curse of Jeconiah (Jehoiachin).
24 As I live, saith the LORD, though Coniah the son of Jehoiakim king of Judah were the signet upon my right hand, yet would I pluck thee thence;
25 And I will give thee into the hand of them that seek thy life, and into the hand of them whose face thou fearest, even into the hand of Nebuchadrezzar king of Babylon, and into the hand of the Chaldeans.
26 And I will cast thee out, and thy mother that bare thee, into another country, where ye were not born; and there shall ye die.
27 But to the land whereunto they desire to return, thither shall they not return.
28 Is this man Coniah a despised broken idol? is he a vessel wherein is no pleasure? wherefore are they cast out, he and his seed, and are cast into a land which they know not?
29 O earth, earth, earth, hear the word of the LORD.
30 Thus saith the LORD, Write ye this man childless, a man that shall not prosper in his days: for no man of his seed shall prosper, sitting upon the throne of David, and ruling any more in Judah.
(Jeremiah 22)
The king must have repented while in the exile because he was eventually released from the prison. And in 2 Kings 25 he is pictured as another Joseph. It is a partial reversal of the curse.
27 And it came to pass in the seven and thirtieth year of the captivity of Jehoiachin king of Judah, in the twelfth month, on the seven and twentieth day of the month, that Evilmerodach king of Babylon in the year that he began to reign did lift up the head of Jehoiachin king of Judah out of prison;
28 And he spake kindly to him, and set his throne above the throne of the kings that were with him in Babylon;
29 And changed his prison garments: and he did eat bread continually before him all the days of his life.
30 And his allowance was a continual allowance given him of the king, a daily rate for every day, all the days of his life.
(2 Kings 25)
Then we have the complete reversal of the curse of Jeconiah in Haggai 2. Zerubbabel was a descendant of Jeconiah.
23 In that day, saith the LORD of hosts, will I take thee, O Zerubbabel, my servant, the son of Shealtiel, saith the LORD, and will make thee as a signet: for I have chosen thee, saith the LORD of hosts.
(Haggai 2)
As a result, Jesus can have Jeconiah (Jehoiachin) in His genealogy and still be a legitimate Davidic king (Matthew 1:11).
11 And Josias begat Jechonias and his brethren, about the time they were carried away to Babylon:
12 And after they were brought to Babylon, Jechonias begat Salathiel; and Salathiel begat Zorobabel;
(Matthew 1)