Unfortunately this is a spurious finding. See this presentation: https://youtu.be/qlTnnQytOJ0
The mechanism is that people with the shingles vaccine are less likely to visit the hospital (because they don't get shingles). Because they have fewer hospital visits they are less likely to receive an incidental diagnosis of dementia from a hospital.