There used to be phonebooks on the Internet where you could put in your personal information and if everyone else did so too then you had this giant database of contact info where you could look people up. These of course had to make money somehow, but when you're sitting on a giant pile of personal information that's quite valuable in itself. It's a pity most uses of personal information for financial gain is morally dubious, but as long as you stay cash flow positive you don't
have to turn evil.
Everybody understood implicitly that you only put in your own information. Giving away other people's personal information to a some company for which it is clearly valuable is not considered nice. It's simply not yours to give away. For the few who didn't understand this most companies had this in their terms of service anyway, as there could be legal risks involved.
All those companies are gone now. They are out-competed by a select few very large companies who did everything possible to make it very easy for people to input everyone else's contact information in their database, including making that behaviour default in the software that ships with your phone. In the beginning you could ask people nicely not to input all your personal info in third party phone book services. That's not really possible anymore.
The days when you could practically opt out of these companies are long gone.