The truth is a bit more … nuanced.
For instance, those that wish to join the Church, catechumens and candidates, have baptism of intention.
Martyrs that profess the faith but are unable to be baptized have baptism of blood.
As for other non-Church members, it boils down to the oft-debated topic of invincible ignorance.
Basically, those that have it are incapable of knowing the truth of the church and are not judged for that incapability, while those that know and believe that the Church is right but reject nevertheless, are condemned.
For example, someone that grew up, lived, and died Protestant in some little podunk town and never had the opportunity to consider Catholicism would likely have invincible ignorance, but you can’t really know for sure.
A member of an uncontacted tribe in the Amazon jungle would have invincible ignorance.
For a person that grew up, say, Methodist in the suburbs, it would be different; if the reason they never learned about Catholicism was that they were simply too lazy to try, that wouldn’t be invincible ignorance, at least not fully.
But if they did learn about and reject it, do they count? It depends on them. Did they fully understand, and a myriad of other questions rise up. We don’t know for sure.
Invincible ignorance is quite a thorny subject because it’s not an exact science. How freely invincible ignorance is given and what exactly it means is often hotly contested.
So while it may be true that salvation can’t be found outside the Church, what that statement entails is a whole lot more complex.