the only answer is to hire really smart and passionate people, but in order to attract and keep them you need to give them really cool things to do. really smart and passionate people don't want to make bleeding edge technology to push more ads. So they have their "20% time" policy, along with their google x projects, which are just ways to keep their workforce engaged while they improve search and ad placement.
The problem with your argument is that very few of Google's engineers work on search or ad placement, and those that do, by and large, don't work on other stuff. As a Google employee, I'll readily admit that the coolness factor of Google's moonshot projects does give me warm fuzzies, but those warm fuzzies don't really affect me on a day-to-day basis -- and I don't really need them because the stuff I do work on is actually plenty cool all on its own. I know some search engineers and some ad engineers, and they're really engaged in what they're doing, too... in fact, I'd argue that your basic premise, that search and ads are boring, is completely wrong as well.
Search, for example, is a really, really hard problem, for many reasons. To start with, the web is huge and continues growing rapidly, so the architectures and algorithms needed to handle that scale are pretty fascinating on their own. Speed is another really interesting challenge; Google wants to serve results, end to end, in well under a second (the actual target is often-discussed, but I don't know if it's confidential so I won't mention it). This requires not just making Google's systems very fast, but demands research into optimizing the user's browser and the Internet itself. Then there's the problem whose initial solution made Google into a success: Given some search terms and given a corpus of scraped data, how you do provide the best results? And the only reasonable definition of "best" is "the ones the user wants". PageRank was a good first approximation, but if Google were to go back to simple PageRank today everyone would abandon it in a hurry because today's ranking algorithms are far, far better. But they're still a long way from done. Significant recent improvements have come from the Knowledge Graph project, which aims to enable the search engine (and other stuff) with some degree of semantic knowledge about the queries and the content. To really solve search, you actually need to fully understand all of the content on the web and also make high-quality guesses about what the user is actually looking for. Larry Page often says that search is about 5% done.
Ad serving is actually a very similar problem. You have a corpus of ads. You want to display ads that the user finds useful. Or, ideally, if you can determine that nothing in your corpus is really useful to the user, display nothing. The perfect ad-serving system will serve no ads most of the time, showing only ads for items that a user wants to buy, when they want to buy it, and you have relatively little contextual information to use to make that decision. There are other issues as well. For example you want to maximize ad revenue which means you need to take into account the advertisers' bids, but in the long run users will more often click on ads if they have good experiences with the ones they choose, so there's a vague sense of user experience value as well. Choosing not to display any ads sometimes is part of maximizing user satisfaction as well. Arguably, doing all of this perfectly is an even harder problem than search.
So... no. Google doesn't do all of its moonshots merely to keep its employees interested. If that were the reason, it would be both unnecessary and ineffective.
The real reason, I think, is pretty straightforward. Google is looking for the next $100B product. Google was built on one solution that became massively successful. At the time, it wasn't even obvious how to monetize it. What was clear was that there was a challenging problem to solve, and that the solution would be useful to people. So Google's moonshots are all about trying to replicate that success... and it's fully understood that nearly all of them will fail, and that some that succeed won't be easy to monetize but if you attack enough important problems with enough smart people, you will find success.
Aside: lots of people look at Google's projects and think "How can they use that to get data to make ad serving better", but that really isn't how anyone at Google thinks; the expectation is that if you do something big that a lot of people use there will be some way to make money from it, and finding that way is the project that follows quickly after you solve the problem. There is no a priori expectation at Google that ads will be the right monetization approach. This point is why I often explain to people that Google is an engineering company, not an advertising company. It just so happens that Google's most successful projects are best-monetized with ads, so that's how it gets 90+% of its revenue.
(Disclaimer: I work for Google but I don't speak for Google. The above represents only my own opinions.)