From what I understand, you can run for office even if you’re in prison.
In my view, the only reason to jail anybody is because they violated the law. If somebody that violated the law is subsequently jailed, it feels pretty dishonest to say that it was done “just to take them off the ballot”. Not only that, it is inaccurate. Jailing somebody does not take them off the ballot. However, not prosecuting them DOES put them above the law.
Perhaps we have different ideas about the real problems described above.