Why does discourse leave "(post deleted by author)" debris after deleting a post

Is it some sort of shaming, or just to pique the curiosity of readers?
It breaks up the flow of the conversation putting extra junk before the corrected post.

I don’t think it’s either of those; that post had a URL which led directly to it, and when the post is deleted that URL should still land in a useful place instead of returning a ‘not found’ result.

I think the deleted post goes away after a bit? Or maybe a moderator hid it.

Maybe it’s so you can still flag the post if it was spam, so you can’t break the flagging system by repeatedly posting and deleting the post quickly thereafter?

Keep in mind that post deletion doesn’t git rid of the copies sent
via E-mail to those of us with our accounts set to “mailing list
mode,” nor does it prevent us from responding to a deleted post and
potentially even quoting part or all of it in our posts. No
notification is sent to subscribers when a post is deleted, so we
have no way of knowing that we shouldn’t reply to it.

Assuming you’re using the web UI, the intended flow is that you just edit the original post rather than delete and re-post it. The “deleted” serves as an indication for the record that the post was there but was later deleted. Though, if you do create a post (or at least a thread) and delete it within 5 minutes, the indication is not shown.

Also, deleted posts are still visible to mods for moderation reasons, and while I can’t confirm it now as I’m not a user, I believe mod/flag hidden posts are shown as “hidden” rather than “deleted” and may be expandable (though again, cannot 100% confirm what normal users actually see in specific circumstances).