Yes, I experienced this a number of times in my life.
Growing up in a small Swiss village I wasn’t born in, I had to learn that you basically greeted everybody you passed in the road, under the assumption that you knew them or were supposed to know them (more conversations were not needed).
Moving to a large Swiss village, I had to learn that saying hi to random strangers was considered weird at best.
First time I visited Southern California, I was very uncomfortable with strangers striking up random conversations. Later in the trip in San Franciso, I felt that the slightly toned down form of this habit was more comfortable for me.
Moving back to Switzerland after having lived in CA for a few years, I had to relearn old habits.
grüezi!
Similar experience here. I grew up in rural Ireland in the 80s where you said hello to everyone but had a culture shock when I moved to Dublin for college. I quickly realised that you don’t greet everyone. I put it down to a being a matter of scale: in the countryside, it’s easy to say hello to everyone when you’ll usually encounter only a small number of people. It’d be impossible to say hello to everyone in a big city.
I still say hi to people when doing things like hiking a trail that’s off the beaten track: we’re sharing a similar experience and have that one thing in common. If it’s a popular trail or busy weekend, it’s more akin to being in a large town where you don’t say hello.
Another rural-urban division in Ireland is that in the countryside, car drivers greet oncoming drivers – whether they know each other or not – by subtly raising a finger or two while keeping their hands on the steering wheel. Since the 80/90s, this custom has been dying out in the counties near Dublin but I still see it in the West of Ireland. A few years ago, we were holidaying in West Cork and my wife was driving but hadn’t realised we were being greeted by the locals. As a Dubliner, she’d never even heard of this practice.
Edit: By the way, I just noticed your username. Seeing that you’re from Switzerland, I was wondering if it’s a reference to the Celtic Frost album?