I was thinking along the same lines. Isn't it just doxxing? Going deep into someone's online history and making hypothesis about who they are in real life, then publishing their name and what they do?
I fail to understand "why". There is this awesome band, Angine de Poitrine, that makes being anonymous a big part of the fun. Some people are trying hard to dox them, and I heard that someone already did it. What if they decide to quit, now that the fun is over if they are not anonymous anymore? Congrats, you fucked up the party and nothing was gained.
Indeed, unless they're already a public person (such as celebrity or public figure of note).
Let's keep in mind that doxxing is not a universal concept nor are its mechanisms universally perceived as negative/frowned upon outside of specific online areas.
I don't know of any law against it except for specific populations like law enforcement and even those usually have exceptions for journalism.