How old is the "你吃飽了嗎" greeting in Chinese?
The quick answer to your question is: " No one knows exactly when."

As far as I know, asking someone: " 你吃了飯沒？"(Mandarin) or 你食咗飯未呀？" (Cantonese) is a very typical way to start a conversation nowadays.

It must be a very long time ago. My speculation is: "It started as far back as human communities first formed."

In ancient time, when living was difficult for most, having a reliable food source, able to feed regularly was a major achievement. That fact alone qualified someone's life as a fine one.

It is not hard to imagine, in ancient time, when someone saw his neighbor, the first words out of his mouth would be: "你好嗎?"(how are you) to indicate he was friendly (not a threat) to him. Then followed up with asking how was his life by saying " 你吃了飯沒?" (have you eaten dinner yet?). Since having meals was the most important thing for everyone, you wanted to make sure the other person had already eaten, before engaging him in any activity or conversation.

If the answer was " yes", then you knew his life was fine, and free to engage in activities or conversation with you.

If the answer was no, then it was a chance to invite him to have dinner with you, because it could show off your wealth and generosity. (see? I have food to spare!)

Also, gathering around the fire to have a meal together was an important form of socializing back in those days. If you were not really close to that person, you would just excuse yourself and leave him alone (so he can find food for himself).

We still do the same today. Eating dinner together, is still a major form of socializing.

By the way, the exact wording might be distinct from region to region, and it might have changed many times as time passed.