The article says that one possible reason the vaccine protects against dementia is incidental protection from other diseases. Getting chickenpox as a kid might protect you against shingles, but maybe not against those other diseases.
No! The opposite thing is true. Getting chickenpox as a kid drastically increases your likelihood of getting shingles as an adult. The initial chickenpox infection is the mechanism by which you're set up for shingles: you get it, fight it back, and it remains dormant in your nerves. Shingles is not simply chickenpox; it's the secondary infection you get from a resurgent zoster outbreak based in your nerves.
I got chickenpox and shingles as a kid. I was young enough to not remember the chicken pox (which I I think I got from one of my older siblings), and then in second grade I got the shingles, which I had never even heard of at the time. As a late millennial (of parents who were not antivax by any means) I imagine if I were even a few years younger I probably would have gotten the chickenpox vaccine and been able to skip both.
Getting chicken pox as a kid means you already have the H. zoster virus in your system, and when you get older as your immune system weakens, it may come out for a second go around, manifesting as shingles. Having had chicken pox as a kid is one of the reasons why I got my Shingrix as soon as I was able.
We don’t really define infection well (especially in a context where you’re waiting 2-6 weeks for an appointment to get bloodwork ordered, by which point the blood is often irrelevant to the complaint 2-6 weeks prior).