I believe Jesus is speaking to anyone who will ever hear His words. And the gate of which He is speaking is Himself. So you were correct in what you have always thought. This is clear from the content of a parallel passage on this sermon which is found in
Luke 13:24-30. You see, the Bible is its own best commentary. And in Luke we are clearly shown the meaning of what Jesus said in the passage you are asking about.
Here's is what God reveals through Luke:
24“Strive to enter through the narrow gate, for many, I say to you, will seek to enter and will not be able.
25When once the Master of the house has risen up and shut the door, and you begin to stand outside and knock at the door, saying, ‘Lord, Lord, open for us,’ and He will answer and say to you, ‘I do not know you, where you are from,’
26then you will begin to say, ‘We ate and drank in Your presence, and You taught in our streets.’
27But He will say, ‘I tell you I do not know you, where you are from. Depart from Me, all you workers of iniquity.’
28There will be weeping and gnashing of teeth, when you see Abraham and Isaac and Jacob and all the prophets in the kingdom of God, and yourselves thrust out.
29They will come from the east and the west, from the north and the south, and sit down in the kingdom of God.
30And indeed there are last who will be first, and there are first who will be last.” (Luke 13:24-30)
So, there can be no doubt that Jesus is speaking of admission to heaven. So, based on content, I reiterate that the way you have always considered this passage is correct.
Now, you speak of the context of
Matthew 7:13-14. The wider context is what we know as the Sermon on the Mount, as passed on to us by Matthew, who was there. It is a collection of Jesus's teachings on the attitudes, the lifestyle, that pleases God. Indeed it should be the lifestyle of one who follows Him. But after His moral teachings (which run from
Matthew 5:3 to
Matthew 7:12) Jesus changes the topic from the marks of a follower to a series of warnings. First He warns that the way into God's Kingdom is a narrow way. And later, according to John, says He is that narrow way; for He says that the door into the metaphorical sheepfold of which He is the good Shepherd—in other words, Heaven—is Himself. Incidentally, this is the third of the seven I AM statements that John records Jesus as making:
1. I AM the bread of life. He who comes to Me shall never hunger, and he who believes in Me shall never thirst” (
John 6:35).
2. I AM the light of the world. He who follows Me shall not walk in darkness, but have the light of life.” (
John8:12)
3. I AM the door of the sheep. All who ever came before Me are thieves and robbers, but the sheep did not hear them. I am the door. If anyone enters by me, he will be saved and will go in and out and find pasture.” (
John 10:7-9).
4. I AM the good shepherd. The good shepherd gives His life for the sheep…I am the good shepherd; and I know my sheep, and am known by My own.” (
John 10:11,
14).
5. I AM the resurrection and the life. He who believes in Me, though he may die, he shall live.” (
John 11:25).
6. I AM the way, the truth, and the life. No one comes to the Father except through Me.” (
John 14:6).
7. I AM the true vine and My Father is the vinedresser… I am the vine, you are the branches. He who abides in Me, and I in him, bears much fruit; for without Me you can do nothing” (
John 15:1-5).
Following the warning that the way to God is narrow, Jesus then warns us to pay attention to the teachers we follow. And He lets us know that we will be able to identify good teachers and bad teachers by the fruit that their lives bear (Matthews 7:15-20). And then He segues into the reason we need to pay attention to the teachers we follow: namely that unless we follow the correct teaching we may indeed find ourselves shut out of Heaven...even if we have performed all sorts of religious works (Matthew 7:21-23). Finally, following those three warnings, He concludes by telling us that when we build our hopes on Him we will not be disappointed. As Paul says in 1 Corinthians 3:11— "no other foundation can anyone lay than that which is laid, which is Jesus Christ."
I hope this little study helps.