Internally, Google is not so different from an ecosystem of VC-funded startups. They try a lot of things. Some ideas work and others don't.
The alternative is to never ship new products out of fear of failure. Or, to indefinitely support everything, regardless of how tiny. Or, to wait so long to derisk a new product that they possibly miss out on a new market (I'm looking at you, HomePod).
At the end of the day, this strategy has worked out well for them, so why stop? For every failure like G+ or Allo, there's a success like Google Photos or Duo.