First, the symptom of a SIM swap is that you lose signal on your phone. Using a primary number rather than a secondary, i.e., one your mum will usually call you on instead of a SIM card you put in the drawer, is the best way to detect it earlier and act earlier. You'll detect something's wrong and try to get in contact with your provider to discover evil. And do your best to gain ownership back.
You don't protect yourself: providers do
It's not up to you, but all about the education of your service provider not to use SMS as the only recovery factor.
If your service provider using SMS recovery holds information or assets (e.g. cryptocurrency, information that may permanently damage your personal reputation like very personal media) that are totally unrecoverable after incident, then you should just change provider; you can't protect yourself. Even if you write to customer service, they may bounce you on excuse of paranoia (reason is budget).
Also depending on your jurisdiction, and the environment your service is operating in, you have a few more chances to protect not from SIM swap, but from consequences.
Bank example: if your bank operates under PSD2 (e.g., Europe) and they use SMS as the only recovery factor, by the time you report the incident to your provider and/or police, you are protecting yourself from fraudulent trades until you can call the bank and shout "stop everything! somebody stole my number!". The laws, your mileage may vary, according to jurisdiction, can add a layer of protection so that you could get your money back.
As a final note, many (four+) large banks of my knowledge are aware of SMS weakness and use it as first and not only recovery factor. The second factor are.... security questions!
SIM swap is matter of mobile operators, not customers
Also remember that the SIM swap is a matter of people who work at the mobile operator, so you can't really make the difference. In order for someone to obtain a SIM card fast, one should go to a physical retailer, with either counterfeit ID or they must really really really really look like you for identification.
If I call your mobile operator and say "Hello, this is J. Doe, I was born on 01/01/1990 in Dallas, could you mail a replacement SIM to Evergreen Terrace?" without any additional form of recognition, then that's your carrier's fault!