Yes, a person can automate their job until they're not doing anything, and yes, a company can punish an employee for sitting idle. But the latter is inherently stupid. Automation both achieves the goals originally set out for an employee, and frees them up to do more work, without any additional cost.
The business's goals should include adding value and productivity and reducing cost. If an employee automates their job, they've improved on their job productivity, which adds value to the company at no extra cost. In the article, the company has a choice:
A) fire the employee and hire a new one to keep doing the job manually.
B) fire the employee and keep the automation.
C) keep the automation, keep the employee, train the employee for a new manual job.
D) keep the automation, keep the employee, train them for a new manual job, and have them automate that.
If the company chooses A), they're just stupid. If they choose B), they're at least eliminating an unnecessary position. If they choose C), they do the same as B), except they also retain a person that is already trained and accustomed to the company, which saves time and money. If they choose D), it's the same as C), plus they can continue to lower costs and add value.