Hypothetically, what if an ex-President loses it and starts spilling state secrets?

Yep, I totally agree.

A former President who just decides to leak classified information would just be arrested, like any other person making an unauthorized disclosure.

There wouldn’t be any Secret Service hijinx, no relegation to a black site, no tampering with Twitter or iPhones, no insane asylums. Just arrest and prosecution.

If an ex-President wouldn’t shut up after arrest and conviction, they would probably end up in solitary confinement somewhere so they have very limited ability to speak to the outside world. Just like any other person convicted of the same crime.