I've heard it explained that "hey" used to be more of an urgent way to get someone's attention, rather than a casual "hello" like it is now, so it sounded rude to some older folks.
It was what passed for a meme back in the 1950s. There was a comic alphabet that was performed as a turn in the music halls. It started off with "A for horses, B for Mutton, C for miles" and so on.
It does, and if there is a recorded version at that date you can bet it had been floating around for longer than that. Reason I said 50's is because that was when my parent's generation were in their young adulthood which if you think about it is where all these catchphrases really set up home in your brain. The other thing, now I think on it, is that it wasn't said as a response to 'Hey' as a greeting it was always said to stop the somewhat Cockney way of indicating you hadn't heard. What they wanted you to say was 'Pardon?' or even 'I beg your pardon?', they didn't like 'What?' all that much and couldn't abide 'Eh?' or 'Ay?' So it it was usually more of that same 'Don't talk to your elders like that' bullshit that all the baby boomers rebelled against.