Very good point. Eventually the routine stuff gets automated. For instance [1] is an attempt previously covered on HN to generate code from an interface mockup/screenshot. Obviously this'll take years of work to perfect, but because UI wiring code is pretty routine for simple forms, I can totally see this working eventually.
That seems more likely when you are bad, not average.
But there is also the problem that average is relative. I consider myself average, when comparing to the best developer in my company. But I am sure he considers himself average when comparing himself to other outstanding famous developers.
i wouldn't be surprised that , in certain cases , being an average coder but having another skill: knowing how to work well with people, political capital in your company, enough domain knowledge, being hard working, choosing to work in a more stable org or the public sector, may be a good enough barrier to competition.
This stands in many other industries of course, but the point is that not pushing for being better is not a viable long-term strategy if you need to earn a living from it.