When should I stop building farms?
Solution 1:
I don't think there is any rule that you can follow to build the perfect number of farms, since it really depends on the situation. You can, however, make an informed decision about how many you should build.
To answer your second question first, if a tile is not being worked by a citizen it does not improve your gold, food, or production yield. The only situation where an unworked tile is beneficial is when it contains a luxury or strategic resource. If you aren't working the luxury/strategic resource, but it has the correct tile improvement, it will still be available.
With this in mind, there isn't really a need for 10 farms around a city with 2 citizens. If you listen to the AI recommendations for workers, it will often suggest you build only farms around a low-population city. This is more telling you "you should increase this city's population" rather than "there aren't enough farms." So when building tile improvements make sure you don't just overload on farms. A city with a population of 20 but no production or gold yield isn't nearly as useful as it could be.
In general, try to always consider what improvement would be most effective on a given tile, and what your current goal is. If you have a small city, start by improving tiles that will give you the highest food yield. After you have a few food-generating tiles prepared, try to increase production. This will help you build things such as a water mill or granary in your city itself to further increase growth. After you have a decently sized city you should balance food, gold and production improvements. You want to maintain steady growth, but you also want your city to be as productive and as economically viable as possible.
There is no harm in replacing one tile improvement with another if necessary, but generally you should try to plan ahead by improving tiles in the most optimal manner from the start. City location is very important here, as if you're surrounded by deserts you will always have a weak city.