Ezekiel 37 is a vision concerning the resurrection and in-gathering of the scattered northern tribes of Israel in the last days, in the time of the messiah aka "the millennium". In the vision, "David" refers to Israel's anointed son of David, aka "the Messiah" ("messiah" translates the Hebrew for "anointed [one]" or "[the one] smeared with oil", referring to the rite by which kings and priests were consecrated. So, "David" refers to the promised son of David who would come and fulfill God's promises.
The chapter is predicting that the scattered and assimilated tribes of Israel, though as spiritually lifeless as a valley of dry bones would be resurrected spiritually and be drawn to Jerusalem for the grand finale of history: the arrival of the Messiah to take vengeance on his enemies and glorify the whole house of Israel in their own land.
First God promises the resurrection of the impossibly dead northern tribes:
NASB Ezekiel 37:
11Then He said to me, “Son of man, these bones are the whole house of Israel; behold, they say, ‘Our bones are dried up and our hope has perished. We are completely cut off.’ 12“Therefore prophesy and say to them, ‘Thus says the Lord GOD, “Behold, I will open your graves and cause you to come up out of your graves, My people; and I will bring you into the land of Israel. 13“Then you will know that I am the LORD, when I have opened your graves and caused you to come up out of your graves, My people. 14“I will put My Spirit within you and you will come to life, and I will place you on your own land. Then you will know that I, the LORD, have spoken and done it,” declares the LORD.’”
This began under John, who prepared the path, Jesus was sent to gather the lost and the apostles gathered the rest. Paul rested upon his laurels after having reached the whole of his target demographic.
The reunion of North and South in Jerusalem is described in the next section:
15The word of the LORD came again to me saying, 16“And you, son of man, take for yourself one stick and write on it, ‘For Judah and for the sons of Israel, his companions’; then take another stick and write on it, ‘For Joseph, the stick of Ephraim and all the house of Israel, his companions.’ 17“Then join them for yourself one to another into one stick, that they may become one in your hand. 18“When the sons of your people speak to you saying, ‘Will you not declare to us what you mean by these?’ 19say to them, ‘Thus says the Lord GOD, “Behold, I will take the stick of Joseph, which is in the hand of Ephraim, and the tribes of Israel, his companions; and I will put them with it, with the stick of Judah, and make them one stick, and they will be one in My hand.”’ 20“The sticks on which you write will be in your hand before their eyes. 21“Say to them, ‘Thus says the Lord GOD, “Behold, I will take the sons of Israel from among the nations where they have gone, and I will gather them from every side and bring them into their own land; 22and I will make them one nation in the land, on the mountains of Israel; and one king will be king for all of them; and they will no longer be two nations and no longer be divided into two kingdoms. 23“They will no longer defile themselves with their idols, or with their detestable things, or with any of their transgressions; but I will deliver them from all their dwelling places in which they have sinned, and will cleanse them. And they will be My people, and I will be their God.
There may be a reference to this here:
[John 4:9-10, 19-26 ESV] (9) The Samaritan woman said to him, "How is it that you, a Jew, ask for a drink from me, a woman of Samaria?" (For Jews have no dealings with Samaritans.) (10) Jesus answered her, "If you knew the gift of God, and who it is that is saying to you, 'Give me a drink,' you would have asked him, and he would have given you living water." ... (19) The woman said to him, "Sir, I perceive that you are a prophet. (20) Our fathers worshiped on this mountain, but you say that in Jerusalem is the place where people ought to worship." (21) Jesus said to her, "Woman, believe me, the hour is coming when neither on this mountain nor in Jerusalem will you worship the Father. (22) You worship what you do not know; we worship what we know, for salvation is from the Jews. (23) But the hour is coming, and is now here, when the true worshipers will worship the Father in spirit and truth, for the Father is seeking such people to worship him. (24) God is spirit, and those who worship him must worship in spirit and truth." (25) The woman said to him, "I know that Messiah is coming (he who is called Christ). When he comes, he will tell us all things." (26) Jesus said to her, "I who speak to you am he."
Finally, not only are the tribes finally reunited in their own land, they are reunited under a single king for the first time in many centuries. To do this he may have had to raise some physically from the dead!:
[Matt 27:51-53 YLT] (51) and lo, the vail of the sanctuary was rent in two from top unto bottom, and the earth did quake, and the rocks were rent, (52) and the tombs were opened, and many bodies of the saints who have fallen asleep, arose, (53) and having come forth out of the tombs after his rising, they went into the holy city, and appeared to many.
So the "hireling" kings of Israel and Judah would be replaced with the son of David, the one Great Shepherd King of the Sheep and the Good Shepherd King of the Sheep in Ezek 34 and John 10.