No, the whole purpose of the svg() helper is to read/output the file, not to manipulate it.
You can create your own helper to move the logic out of the way. Don’t know if str_replace is your best bet or whether the DomDocument class would be the better option.
But I’d rather do it with a custom helper as you suggest. I’ll look into it and maybe go as far to explore how to make a plugin from it. I didn’t find a plugin that provides this customizability to change the internal markup of the svg.
Do you think this is a good idea? Never really build a plugin, so it would be my first experience with it. But I’m up to the challenge since I’m really invested in the svg format for this specific project.