You're right. Governments have gained the power they have because they offered people a better alternative. I read somewhere that Napoleon was welcomed as a conquerer into parts of Italy because his government was a lot better than the local government. The problem with governments, though, is that they are fairly easy to establish, but, because they claim a monopoly on coercion, they are hard to replace when a better alternative appears.
For example, all of a city's private garbage collectors may do a poor job, so a very capable mayor may convince residents to allow the city to do the collecting. Years later, when situation is reversed and the city is doing a poor job in comparison with private collectors, it will be a lot harder to replace the government collectors with private ones. The correct response to poor private-sector service is not to bring in the government, but to bring in more private competition.
Well of course, how else do you think democratic governments were invented? The market created them.