Thanks for letting me know! I was able to get it to work by doing things in the order you described. I think I originally added the image to the media library without adding a tag, and then tagged it when it was already in the post, using the pane that shows up when you click on the image in WordPress.
In checking into this, I also discovered that you can’t use the same image twice. I was able to put up a post that showed an image with a properly-working tag, but a second post using the same image failed to show the image at all. Probably another fun Mastodon bug that happens when the same image link appears more than once. Either way, this is easy enough to work around; if I ever need to use the same image twice, I’ll just re-upload it.
I also found that edits don’t appear in Mastodon, but that’s fine too; I can just create a new post and delete the first one if I catch errors soon enough.