The situation is of course more complicated than that.
The grid is like a big Tetris board, and nuclear power plants are big multi-prong pieces: they can be good to cover a large surface, but sometimes, they block situations were a better configuration (which is at the end cleaner) is possible.
For example, the evolution of the grid may make a specific nuclear power plant not totally needed (because this region can now get cheap import, because the heavy industries in this area have changed, ...) while still expensive to maintain. In this case, shutting it down is a good idea.
Another example, if you say "yeah, maybe we will built a nuclear power plant there, maybe, who knows", the risk of investing in a renewable power plant that would replace a dirty power plant may be not attractive to investors, and the dirty power plant will continue for years. But if you say you will exit the nuclear, then the renewable power plant is suddenly very attractive and the dirty power plant can, at the end of the process, be replaced.
Another example, the grid needs a balance between production and demand, but demand is not flat during the day, there are peaks. Nuclear power plants, especially the not recent ones, may not efficiently produce non-flat production. In this case, the grid can evolve in a situation where too much "flat production" exists, and where a "flat production" power plant is the one that is not competitive anymore due to the maintenance costs.
...