I think that is two different instances of hostile design for different purposes. For parks, which are for public use, it's to make sure the resources are available for everyone. For underpasses, it's to prevent people from congregating in hidden and mostly lawless (because it is hidden) areas which contribute to more problems (drug use, assault, theft, etc).
This too can be examined under the same lens. If we had additional funding for police, or even just maintenance personnel to keep people from congregating in those locations, then we wouldn't need hostile design to take up that task.
The design features to prevent birds from roosting in overhangs is the same. Labor is expensive, physical impediments are relatively cheap in comparison, so even if ugly and problematic in other ways, they end up being used.
> If we had additional funding for police, or even just maintenance personnel to keep people from congregating in those locations
Despite possibly solving the problem of people congregating at underpasses it does not seem to solve the problem of why these people are congregating there at all.