This is the brutal truth of how crappy our current patent mechanisms are. The definition of what constitutes a patentable extension to practice of ideas that are well known or explicitly in the public domain is very weak. So, until something is patented and actively protected by bulldog lawyers, there is a risk of someone else trying to umbrella it in their own patent. Google's move can even be justified on defensive grounds that some other jerks could do the same. But the core problem is an arms race to the bottom of what trivial distinctions can be claimed.
Publicly disclosing the idea in a way that can be verified after the fact establishes prior art just like filing a patent does.
I’m not a lawyer, but I do know there are services that inexpensively publish inventions and vouch for the publication date after the fact.
Also note that the vast majority of patent litigation never makes it to trial, so whether a patent is “valid” or not is a gray area in practice.
Being granted a patent by the USPTO doesn't guarantee that the patent is actually valid. It's technically possible for them to grant identical patents to two separate people by mistake, and then the courts have to determine which one is valid.