Good gas / bad gas, how do you know?

That’s an interesting possibility but I could see a couple of drawbacks.
One is that any litmus paper wouldn’t detect solid particulates.
Two (and just my personal opinion here) is that the vast majority of the motoring public will simply not want to be bothered with doing this test. It’s far easier to stick the nozzle in the filler neck with no thought of bad gas until when or if the car quits.

As to gasoline contaminated by water or solvents, etc. I think this does happen on very rare occasions but the vast majority of pump failures are due to solid particulant clogged filters. If the filters were changed on a regular basis odds are the number of pump failures would decrease quite a bit.