I've heard this said about cats, that cats view humans strictly as food dispensers. But I've personally seen cats develop separation anxiety when they thought their humans weren't around -- and then settle right down as soon as a familiar human come into view. To a cat, humans provide some manner of physical and emotional
security as well, to say nothing of affection.
It's the same with any healthy human relationship. Can you imagine how sad it would be to make extraordinary efforts for a person who did absolutely nothing for you? We reward those who provide us something of value -- security, affection, a sympathetic ear -- with our sacrifices.