The only ones I've really experienced is either all-inclusive or the gated Hilton in Puerto Rico or for other hotels is just the elevators which require the guest key card to be scanned to go to the guest floors unless there is a restaurant in that floor (common in Vegas but we've had it various other places). But the actual hotel grounds including the lobby? Not really. You can usually explore a decent amount not being a hotel guest. Not sure if Aulani does it still but we went there with a day pass back in 2016.
Not the hotels in Japan, London, Belgium, Luxembourg, Germany, Sweden, Jamaica or St. Lucia. Many encourage guests for the purposes of food or other activities including spa. One common one is breakfast wherein guests either have a lesser charge or no charge and non-hotel guests a higher charge or just a charge to begin with. Cancun is mostly all-inclusives and many hotels have wrist bands so they fall along guarded access more of an all-inclusive.
Obviously people have to understand with examples the remoteness or difficulty in getting to said hotel. The places in Europe so far were generally reached by train but our trip next September in Scotland, Wales and England will have more remote/accessible mostly by car which will likely reduce the anticipated traffic flow. In Jamaica on 7 mile beach in Negril you could freely walk to other hotels for dining with many that we saw just sorta open. In St. Lucia we were staying at Sandals which does keep their 9oaces mostly for hotel guests only however we did visit other hotels including one where our tour guide took us down to the one in between the Piton mountains for a drink. Now my sister-in-law and mother-in-law went to Jamaica, didn't stay at Sandals but they joined a couple they had met out and went back to their Sandals for food and drink, that security was lax.
You're right that a hotel even in the U.S. can restrict access but for the conversation here it was about the lobby which isn't something I've yet to experience outside of something gated. Doesn't mean it doesn't exist but it hasn't been "a lot of places"