Edit: My tone may have indicated that parent's solution was brittle. It's not!
The reason to have a separate system that correctly calls getElementById() is to avoid this issue.
So, it's actually a _less_ brittle mechanism that doesn't rely on legacy mechanisms and lacks the surprises that come with that.
But I do think the legacy browser behavior with the ID attribute as window properties is very brittle for the reasons you suggest
Reading it more slowly, I see it now, and, thank you!
Edit: My tone may have indicated that parent's solution was brittle. It's not!