It is how it works given enough time and size and spherical cows and a bit of vacuum. :)
Amazon does provide jobs, in fact it provides too many jobs, crowding out other buyers on the local market, then after they downside/close, Amazon can effectively set the price of labor there, and it sets it to the minimum. (Meaning Amazon takes all the economic surplus produced, basically those who work there cannot save, cannot really raise children, etc.)
The problem is not that the market doesn't work, the problem is that it doesn't help with the desirable things society wants.
And if we only consider economic surplus, it is better to have Amazon there than not. (Before Amazon we can assume people there had even worse jobs, and the region heavily subsidized by various welfare programs.) But big companies inherently do very profitable things that look like coordination (ie. they look like they are in a cartel), that's why - other factors being equal - they won't open factories/warehouses in already saturated labor markets, instead they pick a place where cost of operation is cheaper (wages are lower).
And then through consolidation the market can get into a (pathological) state where there are only big companies, and they just buy/deter/sabotage new small companies.