I think you can simplify the parsing a lot (and thus make it faster). You already have a document (via the DOMParser), which enables you to query elements. The hostname can be replaced via the URL constructor.
~~~
Array.from(
new DOMParser().parseFromString(await FileAttachment("google_sitemap-content.xml").text(), "text/xml")
.querySelectorAll('url')
).map(n => {
const u = new URL(n.querySelector("loc").textContent);
u.hostname = "example.com";
return {url: ""+u, date: n.querySelector("lastmod")?.textContent};
})
~~~
In the context of sitemaps I'd be cautious to attribute too much meaning to the lastmod date, especially when a CMS also takes injected content into consideration.
Then there's also the folks who think they can push their SEO by frequently updating lastmod :)