I am positing a theory here that other Christians have had. What if when Jesus says "And I tell you, you are Peter, and on this rock, I will build my church, and the gates of hell shall not prevail against it."- Matt 16:18 he wasn't talking about an onslaught from Hell, we are part of the church militant, and gates don't attack, gates fortify. So, Jesus is saying not that despite on slaught and heresies from the devil the church will survive. That may be true, however; it seems the main point is that the Church will over come to the Devil (see Revelation), that death will not overcome them because, in fact, "The Gates of Hell" is a Hebrewism that means "death."
"The phrase pulai hadou (gates of hell) is a Jewish expression meaning “realm of the dead.” The same two words appear in the Septuagint Version of Job 38:17: “Have the gates of death been revealed to you, or have you seen the gates of deep darkness [ puloroi de hadou]?” They appear again in Isaiah 38:10: “I said in the middle of my days I must depart; I am consigned to the gates of Sheol [pulais hadou] for the rest of my years.” In both passages, pulai hadou is a euphemism for death. Notice the parallelism in both passages. The first half of each verse clarifies that the second half of the verse is not about hell but about death. The gates of hell represent the passageway from this life to the grave."- Kevin DeYoung
"From that time Jesus began to show his disciples that he must go to Jerusalem and suffer many things from the elders and chief priests and scribes, and be killed, and on the third day be raised. 22And Peter took him aside and began to rebuke him, saying, “Far be it from you, Lord!e This shall never happen to you.” 23But he turned and said to Peter, “Get behind me, Satan! You are a hindrance to me. For you are not setting your mind on the things of God, but on the things of man.” Matt 16:21-23
notably just after Jesus speaks of the gates of Hell not prevailing he reminds his disciples that he is about to die. Again this seems to point even more to Jesus meaning that death won't overcome the confession of Jesus as Lord in fact, just after this he says to follow him one must take up their cross! The message seems loud and clear persecution is coming, Jesus will be handed over and killed on the cross. "“(Jesus) speaks from this time lowly things, on His way to His passion, that He may show His humanity. For He that has built His church upon Peter’s confession, and has so fortified it, that ten thousand dangers and deaths are not to prevail over it…” (NPNF Vol. 10, p. 494)- John Chrysostom
But, when the time comes where the disciples are terrified and think "This must mean he isn't the Messiah" Jesus is, instead, conquering the gates of Hell.
Ephesians 4:8 provides an even more profound look at this, "This is why it[a] says: “When he ascended on high, he took many captives and gave gifts to his people."
Here, we see Jesus has over came death, he marched into enemy territory and took captives to parade them and proclaim "I have trampled over death by death." And he appeared to his disciples to proclaim the same. The confession of Christ is at war and over coming death and hell for it will cast both into the lake of fire. In fact, we know that "The last enemy to be destroyed is death." - 1 Cor 15:26