Search does not require advertising.
Advertising is probably the simplest way to monetize search. Certainly other strategies could be tried, but that one at least is well understood, and nigh-ubiquitous.
It could also just be sold as a service, or an addition to iCloud+.
If there is an opportunity to increase revenue (subject to mission/values/etc), you take it. A decrease in another line of business doesn’t matter. Or an increase; you wouldn’t say “hey we’ve got this amazing ad opportunity but the AirPods business is killing it so let’s not bother.”
I guess the nuance here is that the business decision might be “our search, with our ads” versus “Google’s search, with their ads, plus $15B/year”. In that case I think there’s a reasonable argument that users are better off with Apple’s ads than Google’s.
If someone searches for "hotels new york" you have what's called a motivated customer. He or she is much more likely to click on an ad for New York hotels.
It's one weird trick, but man, is it a good trick.