Can I block my phone from connecting from a certain countrie’s network?

I live in Spain and since 2017 there are no roaming charges inside the EU, and I’m currently on vacation in a city in Germany that is very close to Switzerland. This means that sometimes my phone will randomly connect to the Swiss network, and because Switzerland is not in the EU I get charged for data roaming, which is very expensive. Is there any way to block my phone from connecting to the Swiss network? I have tried switching my phone from automatically connecting to the strongest network to doing it myself but for some reason my phone won’t let me and it would be inconvenient anyways so another solution would be better.

Can I block my phone from connecting from a certain countrie’s network?