Those waiters were acting familiar to you, possibly for being close to your age, or you being younger than them, they would not just say it to a middle aged guy unless he was a regular. If you went to a "serious" restaurant, a waiter/maitre would have addressed you more formally.
It's not as much a 'stranger' rule rather than a 'respect' rule. You can say ciao to a girl your age you meet, but not to an older woman you don't know well, or to a teacher, a cop, a boss. If you were a receptionist, you would be required to greet the clients, even as young as you, with a more formal 'buongiorno'.