Yolo it's not really possible to disable the profile page entirely, because it's heavily tied to the REST API and that API is still necessary to retrieve discussion and post authors.
Extensions that add information to a user profile usually come with their own permissions that allow hiding their content everywhere, including the profile page and user info card.
An extension could remove the profile route for guests to make the profile pages return a 404 error, but it wouldn't change anything to the data available via the underlying API.
An extension could also disable the user filters that power the list of discussions and posts of a user, to prevent guests from finding discussions for a specific user. Currently almost all filters that ship with Flarum are enabled for everyone as it simplifies the code greatly, but extensions can affect them.