The explanation with the fewest moving parts is that our brain and hormonal systems look an awful lot like the brain and hormonal systems of a cat or a dog and therefore the simplest explanation is that cats and dogs have emotions and thought patterns that resemble ours in very meaningful ways.
The actual scientific explanations that people tend to put forward (as discussed in TFA) revolve around us projecting our own thoughts and emotions onto the animals. To me that seems substantially less rational than just believing that similar neurological structures produce similar neurological results.