I dont think getting banned will remove posts and comments from your history that haven’t been flagged as rule-breaking. All that will happen is that your banworthy comment will get deleted and you’ll lose access to your account, which is the worst outcome because then you can no longer manually delete your history.
Well, when I was permabanned, I could still create an API key and run a script like github shreddit to wipe my account out. I never lost access to my account, I just couldn't add new posts/comments or send messages to anyone.