I believe we can 'know' that dogs experience joy and sadness, both human attributes. I find it no stretch at all to include some degree of a sense of 'loss' in dogs as well.... in fact, I think it's obvious.
Wrote here recently about our cats and how one of them is 'attached' to one of my grandsons. Cat's name is Kylo.... Kylo's attitude when Ashton, (grandson), is home and his demeanor when Ashton is away is easily apparent, you'd have to be totally lacking in perceptive abilities to not see it. Entirely habit? Kylo's attitude toward the rest of us is remarkably changed by Ashton's presence.... friendly, if a bit condescending, when Ashton is home.... aloof and detached when he's not. To me 'habit', and 'habit' alone... is severely lacking in explaining that.
And at worst is - we can't know. To me making my belief at least as equally reasonable and likely as yours. - JamesJM