My newuser_max_embedded_media
setting was 9999.
I just tried changing this to 25 and I believe the act of making this change has resolved the problem (even though I reduced the allowance!).
I tried impersonating the user and posting an image before and after the setting change.
So I think there’s still some kind of bug here, but for a workaround, try altering that setting.
I’ve had a trawl through the code commits and I think the following change might be related (perhaps my customised setting was stored against the old setting key, and this wasn’t “migrated” to a new setting key?):
https://github.com/discourse/discourse/commit/6391db5921d96f936ac2dd2e60bc86424ef75d95