If it costs $1m p/y to run a machine that cooks burgers and fries, or $30k for an employee who can do that _and_ cover something else when someone else is ill, it's a no-brainer. But businesses had to discover that the hard way; until the 80s, most people were still convinced automation would win everywhere, because it had won (and won big) in manufacturing. A combination of factors, from the '80s onwards, made labor costs effectively fall, which created our reality where certain jobs are so cheap that automating them makes no sense.
The "problem" is that, in certain regions, software development costs reached a point where automation looks very, very appealing. If a machine costs 500k p/y to replace a few 150k p/y SWEs without all those pesky employment complications, businesses will happily choose "AWS AI CloudDeveloper"...