Why use PLC instead of microcontroller?
The higher cost of PLCs is offset by the testing (often in nasty environments) they are (or should be) submitted to. Could you design a custom microcontroller system? Yes, but then you'd probably need to certify it.
Customizability is not really a major issue when you have a large plant full of equipment; in fact, you want the opposite, you want stuff to be as standardized as possible.
Also, ladder logic is already pretty much standardized — except for vendor-specific features — which make debugging/porting software between PLCs a simpler task than it is porting between different microcontrollers.
I'd think a major factor is people. The engineers that can design a microcontroller to run a factory are busy making batches of small devices. Engineers that work on brand name PLCs use standard software packages, they don't have to deal with lower level programming, most problems they encounter someone else has already solved with that hardware (comms to strange devices, IO issues, PIDs). Also the engineers are interchangeable, with a good spec or code commenting you don't need the engineer that built a system there when you need to change the code.
It's also a bit like asking why would someone buy a PC when they could build their own.
The environmental issue (physical, electrical isolation, EMI, etc.) is a huge one and has already been covered by other answers.
You also need to consider how PLCs give you a very deterministic environment. They are well understood and have been in place since the 1970s.
You know how long each rung is going to take and you are guaranteed the behavior based on known input parameters. With pure microcontroller programming it can get complicated to figure out exactly how a change in a function is going to affect the whole functioning of the program.
Ladder logic is easy to understand and program for machine control. We have electricians programming them without any involvement from engineering. They can easily troubleshoot the line's electrical systems by themselves and make the appropriate repairs. They can also write their own programs and do modifications to existing ones. The debugging environment is way (and I mean WAY) better than what you can normally accomplish with embedded micros.
With safety systems it becomes even more important to use safety PLCs and their redundant capabilities and watchdogs to ensure proper functionality.
You know have a few PLCs in the sub $100/ea range: CLICK® Series Programmable Logic Controllers (PLCs) (Stackable Micro Brick) and plenty in the sub $500 range with limited IO.
There are some modules that are basically industrialized "micro-controllers" packages. For example most PID temperature controllers can be thought as such.
Having said all that, you can start seeing places in the industry in which computers with real time OS are taking care of control tasks and machine control directly. This will continue to grow specially with networked IO.