If "first to file" is the only thing that matters, then it doesn't matter even if the product already exists. Say a patent troll picks a popular product already in use by millions of people. They see some ideas core to its functionality have never been patented, so they patent them. Then, they sue the original creators of the app for infringement. Now the original creators of the app have to pay the patent troll for infringing on the idea even though the patent troll derived their idea from the app in the first place. This seems extremely unfair, but it seems like exactly what's implied by the "first to file" law.
1 Answer
It's not. An invention, to be patentable, needs to be new an non obvious over all the known prior art, including products on the market or known otherwise to a part of the general public.
First to file merely means that if you invent something and keep it secret and somebody else patents it, you do not have a right to a patent anymore. See for example this question for more info.
Before that, when it was first to invent, people would notarize ideas and store them away just to destroy future patents of others. A patent should instead be a reward for sharing ideas, so that behaviour was not helfpful. (Short, opinionated version of the events)