I (we, well, Warp/Sonnet 4.5) tried all kinds of ways of working around this limitation, but none of them really work right due to complex translations in the parent objects, etc.
We are exploring how best to handle this, in the past SVG was like an island in the HTML and couldn't contain HTML content itself, but it would be very handy if it could!
If you're interested in the subject of <foreignObject> and Mermaid, here's a Grok exploration of the issue, concluding that nothing's really being done in Mermaid development, nor is it on their roadmap. (See the second exchange, mostly.)