What kind of information would you like to hide?
Almost all information visible on a user profile or any way to find a user profile that isn't part of a public discussion comes from a third-party extension: user directory, bio, custom profile fields, profile banner image, etc. If usernames and avatars are visible in public discussion, I don't really see the point of hiding them from a profile page.
Some of these extensions already have permissions that allow hiding the additional data from non-privileged users like guests.
In my opinion any user-defined opt-ins for the visibility of those added elements should be added to the extensions themselves when it makes sense. I don't think a single global setting in Flarum could possibly encompass all use cases.
One change that could be interesting for Flarum itself would be to allow configuration to restrict who can search for posts and discussions by a specific user, and by extension the availability of that information on a user profile page. Still I wouldn't hide the whole profile, I would show the profile and indicate the user needs to login to see the additional information (if the permissions allow it)