I agree with all the things you say are hard: understanding computation, encoding complex requirements, handling edge cases; but typing code into an editor and then re-running your application doesn't provide much support for making them easier. Better tools could help programmers and non-programmers alike work with that complexity much more effectively.
Tools are designed for certain requirements. As the commenter, antimagic, noted, these requirements can conflict. A better tool would definitely have to sort out those conflicts, but at this point we're talking about something like AI.
To talk down the scope of lots of projects, I've always educated a client by saying if certain types of thinking were automated then we'd have to say we were creating AI and that the cost of the project would grow exponentially.