This is an example of the old trope that only random controlled trials (RCTs) can demonstrate causation. It was doctrine enforced until the '90s. Nowadays, statisticians have protocols to extract a causation signal from population studies that are large enough.
That is not to claim lack of vaccination causes dementia. But it means something affected by vaccination does.
When you follow a cohort of 46,000 patients for six years, you get enough good data to draw strong conclusions. That the same numbers came out for a disjoint population of 12,000, over the same period, demonstrates it. But statistics only points you in a direction, it is not biochemistry.