Loss of external power supply is accounted for in safety analyses: plants have emergency systems, batteries, generators, and procedures to maintain cooling. Fukushima showed that a prolonged loss of power and cooling can become serious; this is precisely why post-Fukushima requirements and countermeasures were strengthened. So it is not 'automatic', but it is not a trivial event either.
All FAQ
2.
If the power goes out, does a nuclear power plant automatically go out of control?
False, but it is a serious event.