This could be perceived as slightly condescending or as affectionate.
Personally, I think in a situation where it is done to the host, it seems a little intimate/affectionate and seems to imply, don't get up. Feels like something a partner, relative or very close/very old friend would do. Possibly slightly hierarchical (older sibling to younger) but could also just be very intimate and more an attempt to make contact with the person who has been on their feet the most that day without forcing them to get up (compassionate). I can see this happening, if they have let themselves in and come in behind the host (often the host is seated closest to the door/circulation so they can get up and get things), and sort of say hey affectionately but implying "don't get up". You don't really shake hands with closest family members, friends or significant others. You do with people you see less regularly / know less well and address more formally.
Obviously, even if the intention is equally compassionate, this seems moderately presumptuous if these people are not very close. Heads are one of our most sensitive parts and it is not really a part of the body you go patting on someone you don't know. Unless of course in a soothing way to a child. So yeah. If the people are not close, this can come off as too familiar and / or condescending.
I think clarifying the relationships of people at the gathering would help.