Both reasons are real, and both have costs that fall on other people. The anti-abuse benefit is paid for by everybody who cannot or will not share a number: people without their own phone, people fleeing an abusive partner who knows the number, journalists, and teenagers.
The contact-discovery benefit is paid for in the other direction — on several major platforms, knowing somebody's number reveals whether they have an account, which has been used to enumerate users at scale.
Platforms that skip it handle abuse with rate limits, screening and reputation instead. That is a harder engineering problem and a considerably lower cost to the people using it.