No, Apple is a 'full-stack' tech company. People buy their products both for their hardware and software. If they were just a hardware company, why would they bother making macOS, iOS, iMessage, Safari etc?
Haven’t you heard people whine about how Apple is so much about privacy but they take money from Google to have it as the default search?
They don’t have Google as the default search because of the money, they have it because they think it is the best. Even despite the privacy problems and the control this grants Google.
How does a maps service sell more hardware? Because using their own maps service Apple can completely control the experience.
Now maps was hard and search is much harder still so we may very well never see this released. But even then they can use this as leverage while negotiating with Google, both for money and for control.
Because your claim about them being a hardware company is incorrect.
They market themselves as a privacy focused company. Privacy is all about software and services, not hardware. Search is something they could add to their portfolio to strengthen their privacy stance.
Services are ca. 18% of Apple’s revenue, after years of huge spending and tons of dedicated effort to grow this segment. The fact that it is as high as a fifth is itself a monumental feat.
Hardware sales of the iPhone alone, excluding all computers, AirPods, and iPads, is over 40%.
How does a search engine sell more hardware?