Well, coders by definition write code. If he could automate his job like that, I also wouldn't say he was being employed appropriately. Which brings us to the real issue - the company.
I suspect most of us have had the joy, at some point, of labouring under some clueless middle management type who wouldn't recognise or care about improvement or innovation unless the upper levels told them to. Hell, they wouldn't be capable of an original thought without specific instruction. If the guy was locked into a place like that, for whatever reason, AND WAS ON SALARY, then, *is* it ethically wrong? The company still gets the value they paid for, in a most basic form of the transaction.
Personally, I get bored too easily to be able to do that. I'd be hunting for other things to do within a week, after the shine wore off.
But, it's an interesting ethics question nonetheless.