This goes back to the writings of St. Dionysius and of Gregory the Great. St. Thomas Aquinas developed their foundational teachings. According to the Angelic Doctor the choirs, which designate offices and roles, are
Note that Archangels are second from the last. That St. Michael seems to be the commander of the heavenly host shows that even among angels (who are created persons, but without bodies), so vastly above us in the order of creation, God chose the lowly for His own plans.