This should be fixed since FIX: formatting of wrap tag in composer.js (markdown mode) by renato · Pull Request #38608 · discourse/discourse · GitHub was merged.
I don’t have a full solution for this yet, but I hear you. The thing is that when copying a code block, the natural expectation in a rich editor is to see a code block. If your clipboard contains only a text/plain source, it’ll be parsed as markdown, but if your clipboard also has a HTML payload, it’ll be priotized as-is.
That said, I think we should not force rich mode on automation, which should be fixed when UX: let automation d-editor respect user's editor mode preference by renato · Pull Request #38622 · discourse/discourse · GitHub gets merged.