united-states
Does the law fully protect one's right to do that?
If you don't use prohibited means, and there is no harm done to the individual, then it is legal. It may be rude or creepy, but it's not illegal. There are many things that are rude or creepy that are not illegal.
Everything which is not forbidden is allowed. The cute Latin phrase for that that is sometimes used in legal briefs and opinions to sound more impressive and authoritative is Quod non est prohibitum, permis sum.
Doing so could be evidence of some other crime, like stalking or attempted murder, but stalking generally requires some level of implied harassment or threat, and murder requires an intent to kill. Merely gathering open source information about someone doesn't cross the line from being a fan to committing a crime.
If you gather information about someone's creditworthiness and share it with others on commercial basis, you are subject to credit reporting agency regulation, but it isn't illegal per se.
Some countries might make it a crime or grounds for deportation to gather open source intelligence related to national security on behalf of a foreign power without being an accredited diplomat, but there, it is the purpose for which it is gathered, rather than the gathering the data itself, that is the hook for some level of illegality.
In the same vein, people who fail to register as foreign agents while lobbying on behalf of a foreign power commit the crime of failing to register in the United States.
But the information is not used in the question's scenario for any illegal purpose.
There are a handful of very narrow anti-doxing laws at the federal, state, and local level (mostly for federal judges and a handful of other kinds of high profile public officials) but even then, those laws are only invoked if the information is shared publicly, sometimes with some sort of ill-intent. But, those laws are the rare exception and not the rule. It would probably be unconstitutional to prohibit simply collecting information about someone by lawful means if it isn't shared.