Interesting but very difficult to perform in the right way. Example: Italy has maybe 45k buildings that could show on that map https://it.wikipedia.org/wiki/Categoria:Castelli_d%27Italia but they can't be collected by looking at the English Wikipedia so it's almost empty compared to what could be. Other countries, same problem.
Somebody suggested in other comments that the data could be from OpenStreetMap. Or let people add their own castles, but then you have all the sort of problems of content moderation.
Same in France, where I grew up almost all small village have a castle that is multiple century old.
I can confirm that a lot of castles missing in Germany too