The one time to revise code after receiving an answer is if advice is given in a comment. Unlike answers, comments are temporary and do not have to remain.
If you find something yourself and would like to point it out, even if it's a bug fix, it would be better to post it as a self-answer. It is okay to review your own code; it is not at all discouraged. It should still be in a review format, much like any other review you may encounter on the site.
Bearing that in mind, you should not post the entire updated code (even with improvements) as that could encourage reviews of that code. This is not preferred as answers cannot be reviewed in the same way as questions, but they can still be critiqued like any other review answer.