Can a CPU be replaced without interrupting the processes running on it?
On a multitasking operating system, any process can be paused while other processes are executing. When a process is paused, all of its data is in RAM, outside the CPU. The CPU itself only contains a small amount of data in registers.

On a multiprocessor system, this same mechanism also allows processes (or more precisely threads) to migrate from one processor to another. As long as the processors are connected to the same RAM, a processor switch is no more complicated than a context switch.

The operating system kernel can save the few pieces of data that it normally stores in registers to a fixed place in RAM, and can make its startup code read this data back. All major multiprocessing operating systems can in fact do that: it's called suspend to RAM.

What prevents replacing the CPU during a suspend-to-RAM is not a difficulty with software architecture, but with hardware architecture. It is possible on some expensive servers, but not on a consumer device.

You can actually replace your CPU and restart with your old processes, even on a computer where this requires turning off the power, by using suspend-to-disk. Take all the data in RAM and save it to disk. This is similar to swapping. The kernel needs to do more work, because it has to power down all peripherals and restore their state afterwards. But again there is no extra theoretical difficulty, just a lot of practical difficulties in writing drivers.