You’re talking about different things. Sweden has personal identity numbers and they’re public information. It protects you from being mixed up with someone with the same name. Not from identity theft though.
Making them explicitly public is better than the US situation where they’re treated like a password - a password you can’t change if it gets disclosed, and that lots of people feel entitled to get.