Suppose A is walking down the street and B punches A in the nose, thus committing assault. Legally, A is entitled to claim civil damages against B, and can practically do so if they know A's name and address. Does B have any legal obligation to disclose these to A? Now, suppose that the police get involved and take B's details which he must presumably be required to truthfully give them. Can A certainly get this information from the police, whether or not B wants him to have it, and whether or not the police decide to arrest and/or charge B with the assault?
A need neither B’s name nor their address
A civil claim must identify the defendant - “the man who inched me at such-and-such place on this-and-that date” is sufficient identification.
It also must be served, while an address would be helpful, it’s not a necessity. A could walk about with the Statement of Claim in his pocket and, when he fortuitously sees B, serve it on him. Further, A could recruit all his friends, relations and acquaintances to do the same. In certain jurisdictions, A might serve B over social media. Or, A could go old school and hire a private investigator to find and serve B.
The police have no obligation to keep B’s name and address confidential
Indeed, such things are often released to journalists. It’s unlikely there would be a blanket departmental prohibition on releasing it to the victim.
There are Subpoenas to identify unknown people!
Let's assume Charlene calls herself Alice on Social Media. The Persona Alice defames Bob on Social Media.
Bob now sues the owner of the Alice Persona using "Jane Doe using the name Alice on Social Media" as a stand-in name.
Because Bob can't properly execute service to the unknown Alice, Bob files a special motion with the court and asks for a subpoena to Social Media, asking that Social Media tells who Alice is or inform Bob of anything that can be used to identify and serve the actual lawsuit.
Social Media will answer with what they know and at the same time might inform Charlene that they have been subpoenaed for her identity. If they have nothing else, Social Media can answer with some IP addresses and times from which Charlene accessed the Alice account, and possibly some other information.
The IP data can be used to subpoena the ISP used, which now informs the account owner belonging to those IPs that they were subpoenaed to reveal who the account holder is, and which finally might result in an address and name of a subscriber.
Then the subscriber can be subpoenaed to identify who is "Jane Doe using the name Alice on Social Media".
If identified, Charlene now can get properly served with the actual lawsuit.
Sometimes, there are other ways to serve a lawsuit
Service and information of a lawsuit might be actually effectuated via other means, such as a newspaper ad. Such a means usually would require to fully identify the person in the ad though.
Sometimes you have to identify yourself.
In some cases, you have to identify who you are to a claimant. For example in a DCMA claim, the claimant has to identify themselves, and if you want to make a counterclaim, you need to identify yourselves with your proper address and where to serve you. If you don't give your proper address, that can be used against you when they sue you.