They were emperors. They ruled over rulers of nations. Thus, they were the king of kings. However, this form is the superlative in Hebrew:
(i) The absolute superlative, which manifests the outstanding feature, condition or state of something or someone can be expressed by:
a. A singular noun in the status constructus preceding the indefinite plural form of the same word.
הֲבֵל הֲבָלִים
vanity of vanities = utmost vanities (Eccl. 1:2) --
Van der Merwe, C., Naudé, J., Kroeze, J., Van der Merwe, C., Naudé, J., & Kroeze, J. (1999). A Biblical Hebrew Reference Grammar (electronic ed., p. 236). Sheffield Academic Press.
Ezra 7:12 is Aramaic but has similar grammar. This title means greatest king. However, this is a title the kings gave themselves, not a title the Scripture gave them.
Commentaries
King of kings, on account of the vanquished princes, along with Great King, a common title in the inscriptions.
-- (Ezekiel 26:7)
Lange, J. P., Schaff, P., Schröder, W. J., Fairbairn, P., Findlay, W., Crerar, T., & Manson, S. (2008). A commentary on the Holy Scriptures: Ezekiel (p. 249). Logos Bible Software.
Ancient texts and inscriptions
To Ashur, his lord, Esarhaddon, king of the world, king of [Assyria], governor of Babylon, king of Kar-Duni[ash], king of kings, k[ing] of E[gypt] (M[uṣur]), Patur[isi] and Nubia (Kûsu), [has dedicated this door/building] for his (own) life and the prosperity (šulmu) of his country.
(3) From a clay barrel found in Ashur and published by E. Nassouhi, ibid, as No. XII, 22 ff.
--
Pritchard, J. B., ed. (1969). The Ancient Near Eastern Texts Relating to the Old Testament (3rd ed. with Supplement, p. 290). Princeton University Press.
Ashurbanipal, the great king, the legitimate king, the king of the world, king of Assyria, king of (all) the four rims (of the earth), king of kings, prince without rival, who rules from the Upper Sea to the Lower Sea and has made bow to his feet all the (other) rulers and who has laid the yoke (nîru) of his overlordship (upon them) from Tyre which is (an island) in the Upper Sea and (read: as far as) Tilmun which is (an island) in the Lower Sea—and they pulled the straps (abšānu) (of) his (yoke).
(7) From the inscription in the temple of Ishtar published (with autographs, transliteration, and translation) by R. C. Thompson, in AAA, XX (1933), 71 ff. Text: Pls. xc ff. Translation: ibid., 90 ff.
--
Pritchard, J. B., ed. (1969). The Ancient Near Eastern Texts Relating to the Old Testament (3rd ed. with Supplement, p. 297). Princeton University Press.
I am Xerxes, the great king, the only king (lit.: king of kings), the king of (all) countries (which speak) all kinds of languages, the king of this (entire) big and far(-reaching) earth,—the son of king Darius, the Achaemenian, a Persian, son of a Persian, an Aryan (ar-ri-i) of Aryan descent (lit.: seed).
--
Pritchard, J. B., ed. (1969). The Ancient Near Eastern Texts Relating to the Old Testament (3rd ed. with Supplement, p. 316). Princeton University Press.