Same situation here.
Can God be pierced? Or is this a metaphor?
Well, the answer is
within the text itself. Let's read
The Lord will deliver the tents of Judah as before, so that the glory of the house of David and the glory of those dwelling in Jerusalem will not eclipse Judah. 8 On that day the Lord will defend those residing in Jerusalem; and even the one who stumbles among them will be as David on that day. And the house of David will be like God, like the angel of the Lord going out before them. 9 On that day I will seek to destroy all the nations who come out against Jerusalem.
And I will pour out on the house of David and over those dwelling in Jerusalem a spirit of favor and supplication so that they look to Me, whom they have pierced through. And they will mourn over him as one mourns for an only child and weep bitterly over him as a firstborn
This is a Messianic passage in which God saves Israel from its enemies through the House of David (David's descendant, Jesus).
The House of David is acting on behalf of God, as if it were God...
"like God", or more specifically, like a Messenger of God
"the angel of the Lord".
The enemies of Israel will mourn and weep bitterly over the damage (piercing) they inflicted
over the House of David (and metaphorically, on the God of Israel, on behalf of which the House of David acts).
Therefore, the passage is not saying that the Messiah will be God, or that God will be pierced, but that the Messiah will act like God, a Messenger of God ("the angel of the Lord") and this is how the Messiah will execute God's salvation.