Good guess. The actual mechanism is that people who don't get the vaccination are more likely to need to visit the hospital to treat their shingles, and because they visit the hospital more they have more chances to get a diagnosis of dementia in a hospital. See this presentation: https://youtu.be/qlTnnQytOJ0
The lesson is to be extremely suspicious of findings of causation based on observational studies.
The lesson is to be extremely suspicious of findings of causation based on observational studies.