I’m not sure about that, to be honest. I thought before that modern search engines (GoogleBot) will read the DOM, but now that I think about it, it makes since that search engines might only read the source and not the DOM.
But .. when I Google to check this, it says:
SEO signals in the DOM (page titles, meta descriptions, canonical tags, meta robots tags, etc.) are respected. Content dynamically inserted in the DOM is also crawlable and indexable. Furthermore, in certain cases, the DOM signals may even take precedence over contradictory statements in HTML source code. This will need more work, but was the case for several of our tests.
Reference:
https://searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157