Who is the subject in Zechariah 2:8-11?

And behold, the messenger (מלאך) who was speaking with me was going out, and another messenger was coming out to meet him  (Zechariah 2:3), and he said to him, “Run, speak to that young man (Zechariah), saying (Zechariah 2:4)... For I,’ declares YHWH ( יהוה)...  (Zechariah 2:5)

So a messenger speaks on behalf of God. No problem there but the message has nothing to do with the messenger but contains what God is speaking and saying what he will do. Let's condense it down to the speaker in the paragraph:

"...say to that young man (דבר אל הנער), ‘Jerusalem shall be... And I will be (ואני אהיה)... declares YHWH (נאם יהוה)... I will be...(אהיה) declares YHWH (נאם יהוה)... I have scattered (פרשתי)... declares YHWH (נאם יהוה)... thus said YHWH of hosts (כי כה אמר יהוה צבאות)... he sent me (שלחני)... I will wave (הנני מניף)... YHWH of hosts has sent me (יהוה צבאות שלחני)... behold I come (הנני בא) and I will dwell (ושכנתי) in your midst, declares YHWH (נאם יהוה)... And many nations shall join themselves to YHWH in that day, and shall be MY people (לי לעם)... I will dwell (ושכנתי) in your midst, and you shall know that YHWH of hosts has sent me (שלחני) to you.
Here's how an Orthodox Jewish translation puts it:

For thus says יהוה צְבָא֔וֹת... “After glory He has sent Me against the nations (Zechariah 2:8)...

(God is speaking but says 'He has sent Me'. Who is the he and who is the me? The me is clearly God in context. So who sent God and how can God be sent?)

“For behold, I will wave My hand over them... Then you will know that יהוה צְבָא֔וֹת has sent Me (Zechariah 2:9)...

(Ah, so know we find out who the 'he' is. It is God. So God is sent and sender).

“Sing for joy and be glad, O daughter of Zion; for behold I am coming and I will dwell in your midst,” declares יהוה  (Zechariah 2:10)

So God promises to come and dwell in Jerusalem.

“Many nations will join themselves to יהוה in that day and will become My people (Zechariah 2:11).

Notice that the speaker, God, refers to the Gentiles joining themselves to יהוה and becoming God's people.

Then I will dwell in your midst, and you will know that יהוה צְבָא֔וֹת has sent Me to you (Zechariah 2:11)

God is still speaking and states that he will dwell in Jerusalem and they will know that יהוה sent him.

Conclusion: God is complex in his unity. Two here are described as God - the sent and the sender.

Sounds familiar:

"In the beginning was the Word, and the Word was with God, and the Word was God... And the Word became flesh and dwelt among us, and we have seen his glory... No one has ever seen God; the only God, who is at the Father’s side, he has made him known."

A Hebrew translation puts it this way:
בְּרֵאשִׁית הָיָה הַדָּבָר, וְהַדָּבָר הָיָה עִם הָאֱלֹהִים, וֵאלֹהִים הָיָה הַדָּבָר
הַדָּבָר נִהְיָה בָּשָׂר וְשָׁכַן בְּתוֹכֵנוּ; וַאֲנַחְנוּ רָאִינוּ אֶת כְּבוֹדוֹ
אֶת הָאֱלֹהִים לֹא רָאָה אִישׁ מֵעוֹלָם; הָאֱלֹהִים הַיָּחִיד, הַנִּמְצָא בְּחֵיק הָאָב, הוּא אֲשֶׁר הוֹדִיעוֹ.

Zechariah 12:10

““I will pour out on the house of David and on the inhabitants of Jerusalem, the Spirit of grace and of supplication, so that they will look on Me whom they have pierced; and they will mourn for Him, as one mourns for an only son, and they will weep bitterly over Him like the bitter weeping over a firstborn.” (Zechariah 12:10)

וְשָׁפַכְתִּי֩ עַל־בֵּ֨ית דָּוִ֜יד וְעַ֣ל׀ יוֹשֵׁ֣ב יְרוּשָׁלִַ֗ם ר֤וּחַ חֵן֙ וְתַ֣חֲנוּנִ֔ים וְהִבִּ֥יטוּ אֵלַ֖י אֵ֣ת אֲשֶׁר־דָּקָ֑רוּ וְסָפְד֣וּ עָלָ֗יו כְּמִסְפֵּד֙ עַל־הַיָּחִ֔יד וְהָמֵ֥ר עָלָ֖יו כְּהָמֵ֥ר עַֽל־הַבְּכֽוֹר

Here's a breakdown of the Hebrew:
Zechariah 12:10
... וְהִבִּ֥יטוּ אֵלַ֖י אֵ֣ת אֲשֶׁר־דָּקָ֑רוּ
Here is a breakdown:

  1. הִבִּ֥יטוּ hifil, perfect consecutive, 3 person masc. pl. "They will look at, behold."
  2. אֵלַ֖י preposition with 1 person sing. suffix  "To, towards me."
  3. אֵ֣ת marks the direct object.
  4. אֲשֶׁר relative conjunction "whom."
  5. דָּקָ֑רוּ qal, 3 person pl.  "they pierced."

'...because of those who' or 'the one whom'?

אֵ֣ת אֲשֶׁר is the same in Numbers 22:6: כי ידעתי את אשר תברך מברך .ואשר תאר יואר.  Note that את אשר and אשר are used interchangeably. In every case, when you see את אשר you simply translate "that which" if it refers to a thing or "whom" if refers to a person. Thus Zechariah 12:10 is simply "They shall look on me whom they pierced"

It is not the case, as claimed, that אֵת always appears before the object of the verb. I have found many occurrences throughout the Hebrew Scriptures and below is a comparison between Zechariah 12:10 and Isaiah 41:22 וְיַגִּ֣ידוּ לָ֔נוּ אֵ֖ת אֲשֶׁ֣ר תִּקְרֶ֑ינָה Both begin with the waw/hiphil imperfect verb followed by the indirect object - a suffixed preposition. In both instances אֵת follows the object making אֲשֶׁר a definite noun, 'the one whom', 'he whom'.

Some argue that אֵ֣ת אֲשֶׁר should be translated "because of those who have been..." אֵ֣ת is the object marker and אֲשֶׁר is a relative marker which, what, who. If prefixed as בַּאֲשֶׁר it could have the idea of 'because of' but it is not prefixed with a bet.

Gesenius points out that אֲשֶׁר is not a relative pronoun in the English sense but more a demonstrative pronoun which acts as a substantive in apposition to its antecendent. He goes on to say that this use of אֲשֶׁר is translated into English as agreeing with the antecedent, in this case, 'me' [1]. In other words 'the one whom'.

Smith and Bewer state that it indicates the person referred to, the Me [2].

Brown-Driver-Briggs point out that אֵת is used to make the object more definite [3].
Harris, Archer and Waltke say the same thing [4].
Davidson points out that אֲשֶׁר with אֵת acts like a substantive with the meaning 'the one whom' [5].
Harris, Archer and Waltke and the HALOT agree that the אֵת gives emphasis to אֲשֶׁר [6].

Smith and Bewer comment that some attempt to treat the אֵת as if it were עַל ('concerning' or 'about') but they state that the language cannot be used in this way.

[1] Gesenius, F. W. (2003). Gesenius' Hebrew grammar (E. Kautzsch & S. A. E. Cowley, Ed.) (2d English ed.) (444).
[2] Smith, J. M. P., & Bewer, J. A. (1912). A critical and exegetical commentary on Haggai, Zechariah, Malachi and Jonah (334). New York: C. Scribner's sons.
[3] Brown, F., Driver, S. R., & Briggs, C. A. (2000). Enhanced Brown-Driver-Briggs Hebrew and English Lexicon.
[4] Harris R. L., Archer, G. L., & Waltke, B. K. (1999, c1980). Theological Wordbook of the Old Testament (electronic ed.) (083). Chicago: Moody Press.
[5] Davidson, A. B. (1902). Introductory Hebrew grammar Hebrew syntax (3d ed.) (11). Edinburgh: T. & T. Clark. (85.1).
[6] Koehler, L., Baumgartner, W., Richardson, M., & Stamm, J. J. (1999, c1994-1996). The Hebrew and Aramaic lexicon of the Old Testament. Volumes 1-4 combined in one electronic edition. (electronic ed.) (101). Leiden; New York: E.J. Brill.
[7] Owens, John Joseph: Analytical Key to the Old Testament. Grand Rapids, Mich. : Baker Book House, 1989-c1992

Some have also argued that the Hebrew words “et asher” are not found very often in scripture. When they do occur together the phrase is read as “concerning whom” or “concerning that” but never as “whom“ (Cf.  Ezekiel 36:27). But this can easily be refutted because of these verses:

2 Chronicles 18:13 וַיֹּ֖אמֶר מִיכָ֑יְהוּ חַי־יְהוָ֕ה כִּ֛י אֶת־אֲשֶׁר־יֹאמַ֥ר אֱלֹהַ֖י אֹת֥וֹ אֲדַבֵּֽר׃

Ecclesiastes 2:12 וּפָנִ֤יתִֽי אֲנִי֙ לִרְא֣וֹת חָכְמָ֔ה וְהוֹלֵל֖וֹת וְסִכְל֑וּת כִּ֣י׀ מֶ֣ה הָאָדָ֗ם שֶׁיָּבוֹא֙ אַחֲרֵ֣י הַמֶּ֔לֶךְ אֵ֥ת אֲשֶׁר־כְּבָ֖ר עָשֽׂוּהוּ׃

Exodus 20:7 לֹ֥א תִשָּׂ֛א אֶת־שֵֽׁם־יְהוָ֥ה אֱלֹהֶ֖יךָ לַשָּׁ֑וְא כִּ֣י לֹ֤א יְנַקֶּה֙ יְהוָ֔ה אֵ֛ת אֲשֶׁר־יִשָּׂ֥א אֶת־שְׁמ֖וֹ לַשָּֽׁוְא׃

Exodus 33:19 וַיֹּ֗אמֶר אֲנִ֨י אַעֲבִ֤יר כָּל־טוּבִי֙ עַל־פָּנֶ֔יךָ וְקָרָ֧אתִֽי בְשֵׁ֛ם יְהוָ֖ה לְפָנֶ֑יךָ וְחַנֹּתִי֙ אֶת־אֲשֶׁ֣ר אָחֹ֔ן וְרִחַמְתִּ֖י אֶת־אֲשֶׁ֥ר אֲרַחֵֽם׃

Deuteronomy 5:11 לֹ֥א תִשָּׂ֛א אֶת־שֵֽׁם־יְהוָ֥ה אֱלֹהֶ֖יךָ לַשָּׁ֑וְא כִּ֣י לֹ֤א יְנַקֶּה֙ יְהוָ֔ה אֵ֛ת אֲשֶׁר־יִשָּׂ֥א אֶת־שְׁמ֖וֹ לַשָּֽׁוְא׃
Deuteronomy 29:14 כִּי֩ אֶת־אֲשֶׁ֨ר יֶשְׁנ֜וֹ פֹּ֗ה עִמָּ֙נוּ֙ עֹמֵ֣ד הַיּ֔וֹם לִפְנֵ֖י יְהוָ֣ה אֱלֹהֵ֑ינוּ וְאֵ֨ת אֲשֶׁ֥ר אֵינֶ֛נּוּ פֹּ֖ה עִמָּ֥נוּ הַיּֽוֹם׃

1 Samuel 28:8 וַיִּתְחַפֵּ֣שׂ שָׁא֗וּל וַיִּלְבַּשׁ֙ בְּגָדִ֣ים אֲחֵרִ֔ים וַיֵּ֣לֶךְ ה֗וּא וּשְׁנֵ֤י אֲנָשִׁים֙ עִמּ֔וֹ וַיָּבֹ֥אוּ אֶל־הָאִשָּׁ֖ה לָ֑יְלָה וַיֹּ֗אמֶר קָסוֹמִי־נָ֥א לִי֙ בָּא֔וֹב וְהַ֣עֲלִי לִ֔י אֵ֥ת אֲשֶׁר־אֹמַ֖ר אֵלָֽיִךְ׃
Ecclesiastes 4:3 וְטוֹב֙ מִשְּׁנֵיהֶ֔ם אֵ֥ת אֲשֶׁר־עֲדֶ֖ן לֹ֣א הָיָ֑ה אֲשֶׁ֤ר לֹֽא־רָאָה֙ אֶת־הַמַּעֲשֶׂ֣ה הָרָ֔ע אֲשֶׁ֥ר נַעֲשָׂ֖ה תַּ֥חַת הַשָּֽׁמֶשׁ׃
Proverbs 3:12 כִּ֤י אֶ֥ת אֲשֶׁ֣ר יֶאֱהַ֣ב יְהוָ֣ה יוֹכִ֑יחַ וּ֝כְאָ֗ב אֶת־בֵּ֥ן יִרְצֶֽה׃

1 Samuel 10:8 וְיָרַדְתָּ֣ לְפָנַי֮ הַגִּלְגָּל֒ וְהִנֵּ֤ה אָֽנֹכִי֙ יֹרֵ֣ד אֵלֶ֔יךָ לְהַעֲל֣וֹת עֹל֔וֹת לִזְבֹּ֖חַ זִבְחֵ֣י שְׁלָמִ֑ים שִׁבְעַ֨ת יָמִ֤ים תּוֹחֵל֙ עַד־בּוֹאִ֣י אֵלֶ֔יךָ וְהוֹדַעְתִּ֣י לְךָ֔ אֵ֖ת אֲשֶׁ֥ר תַּעֲשֶֽׂה׃

1 Samuel 16:3 וְקָרָ֥אתָ לְיִשַׁ֖י בַּזָּ֑בַח וְאָֽנֹכִ֗י אוֹדִֽיעֲךָ֙ אֵ֣ת אֲשֶֽׁר־תַּעֲשֶׂ֔ה וּמָשַׁחְתָּ֣ לִ֔י אֵ֥ת אֲשֶׁר־אֹמַ֖ר אֵלֶֽיךָ׃
1 Samuel 28:8 וַיִּתְחַפֵּ֣שׂ שָׁא֗וּל וַיִּלְבַּשׁ֙ בְּגָדִ֣ים אֲחֵרִ֔ים וַיֵּ֣לֶךְ ה֗וּא וּשְׁנֵ֤י אֲנָשִׁים֙ עִמּ֔וֹ וַיָּבֹ֥אוּ אֶל־הָאִשָּׁ֖ה לָ֑יְלָה וַיֹּ֗אמֶר קָסוֹמִי־נָ֥א לִי֙ בָּא֔וֹב וְהַ֣עֲלִי לִ֔י אֵ֥ת אֲשֶׁר־אֹמַ֖ר אֵלָֽיִךְ׃

Ezekiel 5:9 וְעָשִׂ֣יתִי בָ֗ךְ אֵ֚ת אֲשֶׁ֣ר לֹֽא־עָשִׂ֔יתִי וְאֵ֛ת אֲשֶֽׁר־לֹֽא־אֶעֱשֶׂ֥ה כָמֹ֖הוּ ע֑וֹד יַ֖עַן כָּל־תּוֹעֲבֹתָֽיִךְ׃

Ezekiel 23:22 לָכֵ֣ן אָהֳלִיבָ֗ה כֹּֽה־אָמַר֮ אֲדֹנָ֣י יְהוִה֒ הִנְנִ֨י מֵעִ֤יר אֶת־מְאַהֲבַ֙יִךְ֙ עָלַ֔יִךְ אֵ֛ת אֲשֶׁר־נָקְעָ֥ה נַפְשֵׁ֖ךְ מֵהֶ֑ם וַהֲבֵאתִ֥ים עָלַ֖יִךְ מִסָּבִֽיב׃

Ruth 3:4 וִיהִ֣י בְשָׁכְב֗וֹ וְיָדַ֙עַתְּ֙ אֶת־הַמָּקוֹם֙ אֲשֶׁ֣ר יִשְׁכַּב־שָׁ֔ם וּבָ֛את וְגִלִּ֥ית מַרְגְּלֹתָ֖יו וְשָׁכָבְתִּי וְהוּא֙ יַגִּ֣יד לָ֔ךְ אֵ֖ת אֲשֶׁ֥ר תַּעֲשִֽׂין

There are several senses to the word דקר - pierce, thrust, wound, strike and the main idea is to pierce. In the qal it means to "...drive through, pierce, stab, run through, i.e., make physical impact with a sharp implement..." [1]
To "...pierce, pierce through..." [2]
"To thrust through, to pierce..." [3]
"... pierce..." [4]
"...to pierce v., to cut or make a way through..." [5]

[1] James Swanson, Dictionary of Biblical Languages with Semantic Domains : Hebrew (Old Testament) (Oak Harbor: Logos Research Systems, Inc., 1997).
[2] Brown, Francis, Samuel Rolles Driver, and Charles Augustus Briggs. Enhanced Brown-Driver-Briggs Hebrew and English Lexicon. Oxford: Clarendon Press, 1977.
[3] Wilhelm Gesenius and Samuel Prideaux Tregelles, Gesenius’ Hebrew and Chaldee Lexicon to the Old Testament Scriptures (Bellingham, WA: Logos Bible Software, 2003), 206.
[4] Holladay, William Lee, and Ludwig Köhler. A Concise Hebrew and Aramaic Lexicon of the Old Testament. Leiden: Brill, 2000.
[5] The Lexham Analytical Lexicon of the Hebrew Bible (Bellingham, WA: Lexham Press, 2017).

So in Numbers 25:8 “וַ֠יָּבֹא אַחַ֨ר אִֽישׁ־יִשְׂרָאֵ֜ל אֶל־הַקֻּבָּ֗ה וַיִּדְקֹר֙  אֶת־שְׁנֵיהֶ֔ם” the two are pierced through. In Judges 9:54 “וַיִּדְקְרֵ֥הוּ נַעֲר֖וֹ וַיָּמֹֽת׃” the young man stabbed/pierced Abimelech. And in Isaiah 13:15 “כָּל־הַנִּמְצָ֖א יִדָּקֵ֑ר וְכָל־הַנִּסְפֶּ֖ה יִפּ֥וֹל בֶּחָֽרֶב׃” All found were to be pierced/thrust through.
A comparison shows that John's focus was upon the fulfillment of Psalm 34:20 and not Zechariah 12:10. He says:
ἐγένετο [happened] γὰρ [because] ταῦτα [these things] ἵνα [that] ἡ γραφὴ [the scripture] πληρωθῇ [was fulfilled], Ὀστοῦν [bone] οὐ [not] συντριβήσεται [will be broken] αὐτοῦ [of him].
He is talking about the spear incident and relates it to a specific scripture (ἡ γραφὴ - singular noun) "שֹׁמֵ֥ר כָּל־עַצְמוֹתָ֑יו אַחַ֥ת מֵ֝הֵ֗נָּה לֹ֣א נִשְׁבָּֽרָה׃" (Psalm 34:20) being fulfilled. As almost an afterthought he says:
καὶ [also] πάλιν [again] ἑτέρα [another] γραφὴ [scripture] λέγει [says], Ὄψονται [they will look] εἰς [to] ὃν [whom] ἐξεκέντησαν [they pierced].
Nothing about fulfillment of this Scripture, only an acknowledgement that Zechariah's future scenario will find it's fulfillment in this pierced one. No inconsistency here. Zechariah says:
הִבִּ֥יטוּ אֵלַ֖י אֵ֣ת אֲשֶׁר־דָּקָ֑רוּ 'They will look to me whom they pierced'.God is the object here.
John says exactly the same thing without God being the referent because that prophecy has yet to be fulfilled in the future. Translating it into Hebrew reads:
וְעוֹד כָּתוּב אַחֵר אֹמֵר וְהִבִּיטוּ אֵת אֲשֶׁר דָּקָרוּ. The Scripture is the same except for the ommission of אֵלַ֖י.

God is complex in oneness

The Word existed with God and was of the same nature as God. He was God's agent of creation. God in his essence cannot and has not been seen but God's agent who shares his nature and eternity has shown God. Nothing there that isn't in the Tanakh.
Nobody can see God and yet God is seen: “and they saw the God of Israel; and under His feet there appeared to be a pavement of sapphire, as clear as the sky itself.” (Exodus 24:10). And he has feet!
God's Word is creator: “By the word of the LORD the heavens were made, And by the breath of His mouth all their host.” (Psalm 33:6). The idea is there.
Zechariah 2:8 -11

““Then say to him, ‘Thus says יְהוָ֥ה צְבָא֖וֹת, “Behold, a man whose name is Branch (צֶ֤מַח שְׁמוֹ), for he will branch out from where he is; and he will build the temple (הֵיכַ֥ל) of יהוה. “Yes, it is he who will build the temple (הֵיכַ֤ל) of יהוה, and he who will bear the honor and sit and rule on his throne (עַל־כִּסְא֑וֹ). And he will be (הָיָ֤ה) a priest on his throne (כֹהֵן֙ עַל־כִּסְא֔וֹ), and the counsel of peace will be between the two of them (בֵּ֥ין שְׁנֵיהֶֽם).” ’” (Zechariah 6:12–13)

This is not a reference to Joshua himself. Notice that it refers to a man... he will branch out... he will build. Not 'you' as one would expect if Joshua was being described. Also, earlier Zechariah writes:

“‘Now listen, Joshua the high priest... I am going to bring in my servant the Branch (צמח).” (Zechariah 3:8).

Zechariah is referring to the Branch of Jeremiah

““...I will raise up for David a righteous Branch (צמח); ...He will reign as king... this is his name by which He will be called, ‘יהוה our righteousness (יְהוָ֥ה׀ צִדְקֵֽנוּ).’” (Jeremiah 23:5–6)

and

“‘...I will cause a righteous Branch (צמח) of David to spring forth” (Jeremiah 33:15–18).

Earlier again, Isaiah also referred to this future King:

“In that day the Branch (צמח) of יהוה will be beautiful and glorious...” (Isaiah 4:2).

“Then a shoot will spring from the stem of Jesse, And a branch from his roots will bear fruit.” (Isaiah 11:1).

The paraphrase of Targum Jonathan on Zechariah reads:

"... behold (הָא) the man (גֻברָא), Messiah (מְשִיחָא) is his name (שְמֵיה)..."

Branch was understood as a Messianic title. The interesting thing is that this Branch is both King and Priest.

"He will... sit and rule... on his throne... he will be a priest on his throne."

He will bring bring harmonious advice (עֲצַ֣ת שָׁל֔וֹם) between the two offices (בֵּ֥ין שְׁנֵיהֶֽם)

Some argue that the verse is about two people, a priest and a king "And he shall sit and rule on his throne, and the priest shall be on his throne."

That's not what the text says: "וְהָיָ֤ה כֹהֵן֙ עַל־כִּסְא֔וֹ" "...and he will be priest upon his throne..." If you compare 2 Chronicles 13:9 it says the same “ וְהָיָ֥ה כֹהֵ֖ן ” This is how Chabad translates it "[He] will be a priest" and yet translates וְהָיָ֚ה כֹהֵן֙ in Zechariah 6:13 as "... and the priest shall be..."?

Notice that a crown was placed upon Joshua's head. It was a plural crown and yet one*, symbolising on Joshua's head kingship and priesthood joined in one office. He only wore it while the prophecy was proclaimed about the Branch. It became a reminder in the then temple. But... 'those who are far off' will build the temple and not Zerubbabel.

* The crown is plural with a singular verb: וְהָעֲטָרֹ֗ת תִּֽהְיֶה