A long, long time ago, ... in a different company from today, ... it was written in the cabin crew procedures manual (was it the Vol 5?), that; until cabin crew had formally introduced themselves to cockpit crew, they needed to address them (us) as "Sir". There were no "Madams", ... as it were!. After introducing themselves, they could then use first names!
With the passing of time, this "procedure" has evolved into the handshake tradition we have today.
There is almost always an explanation.
Cheers
PS: One more fan for the pigeon analogy!