Most of the countries actually putting bans on gambling are for religious reasons
That might be the case in the most extreme measures and even with those laws, gambling will occur in those countries just not legally. However the majority of bans for gambling is not for religion but for tax and debt reasons, governments dont like competetion and banning gambling outside of the offical government lotto or similar taxed heavily controlled business that serves government is the most common reason for harsh laws or bans on gambling.
You are right, in countries where gambling is banned for what ever reason, gambling is still heavily being participated in but like you said, it's no longer legally, this is the difference.
I remember back in 2022 or so when our previous government banned Twitter (now known as X) in the entire country, they government directed all network providers here in my country to cut all their users and subscribers access to Twitter and so did the network providers do, every one in the country turned to VPN as means of gaining access to the X platform, and so were we illegally accessing twiter for about 5 to 6 months before they lifted the ban.
A ban doesn't shot people out completely from accessing a thing, gambling for example, it only makes access to gambling from that moment illegal and those who don't care about what legal and whats not legal will continue to gamble.