Way to confuse correlation and causation, jeez. We can't just conclude owning dogs causes reduced dementia risk from this, and even the study abstract makes this mistake.
For all we know, for example, it could be that elderly folks who are already doing worse get/are given cats because they require less constant personal attention and exercise (for the human).
And this is assuming the study was well conducted and there was no p-hacking or suchlike involved. I haven't really looked into the paper properly but the size of the reported effect and the weirdness of the claim makes me a bit wary.
From the study paper, if I'm understanding correctly, it appears they gave each participant an initial "baseline" self-reported survey covering everything from health history to subjective personality characteristics, and then they weighted their statistical analysis different for dog owners and cat owners to "balance" against dog and cat owner baseline characteristics. "Weight was calculated based on the physical, social, and psychological characteristics of community-dwelling elderly Japanese dog and cat owners." It says, followed by two quite different lists of which characteristics were used to calculate the weight for dog owners vs cat owners. Color me unconvinced.
Also worth noting that dog and cat owners were defined by whether they marked current or past ownership on the self-reported survey. So if you had a dog when you were 30 or 20 or 13, you're in the dog owner group even if you've never had a dog since, and seemingly regardless of how long you had the dog. It's unclear what they did for people who owned both over the course of their life, but I think they just left them out, unless they were looking for "most recent type of pet owned" rather than "only type of pet owned". I don't know.
The study appears to have been funded by Japanese health institutions/centers rather than, like, a dog food company or something, so that's good.
Apparently they also did a previous study that concluded dogs had a positive effect against "frailty and death". Seems to likewise confuse correlation for causation.
Overall, I think someone really likes dogs, and I don't personally trust any of the rest of this.