SVG gradient rendered differently in Live Preview vs Preview

The issue is that in preview mode the element #Gradient3 is defined twice in DOM and the first instance of it is hidden. Once in markdown-source-view and again in markdown-reading-view.

Mermaid charts have similar issues, they also use IDs that get duplicated. Either Obsidian should not render markdown-source-view and markdown-reading-view in DOM at the same time OR they should be encapsulated in shadow DOM.
But I’m not sure what framework Obsidian uses, maybe neither is possible without major changes.