Masks aren't worn only by infected people they are worn to protect against the virus. The virus exists whether you choose to wear a mask or not. But masks prevent an infected person from spreading it from coughing or from non-infected people from breathing it in.
I think you missed the comment that GP was responding to. They were responding to a claim that if masks only protect the virus from escaping, then masks only protect the selfish population.