The authors explain how they concluded that the vaccine is protective, rather than being correlated with something else that affects the likelihood of a dementia diagnosis.
The study took advantage of the way the shingles vaccine was introduced in Wales: the vaccine was initially offered to everyone who was 79 years old (born between September 2, 1933 and September 1, 1934). It was then offered each year to people who had reached their 79th birthdays. (The vaccine was never offered to anyone born on or before September 1, 1933.) This let the researchers compare people of very close to the same age. They checked, and found no other health intervention with the same cut-off date.
The vaccine did protect against shingles (as expected). It didn't protect against any common medical problems
Wen they broke the data down by gender, the vaccine was definitely protective for women, and enough smaller for men that it may not be statistically significant.
The authors' suggestions for future research include whether protective effect wears off over time, in which case booster vaccines might be useful; whether the vaccine can be useful in treating as well as preventing cognitive impairment; and the broader question of causes of dementia.
Also, these results are for the older shingles vaccine (Zostavax), not the current vaccine, Shingrix.