As I was trying to come up with a simple example to reproduce it I rediscovered that the top-level <data> element specifies an XML namespace, apologies I failed to mention that initially. Would that affect whether the index is used or not?

I'm able to reproduce by loading this data into a new database named ElementsTest:

<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <element><id>1</id></element>
</data>

And then running this query:

for $x in db:open('ElementsTest')/data/element
where $x/id = '1'
return $x/id

The GUI shows the following as the optimized query:

db:open-pre("ElementsTest", 0)/data/element[(id = "1")]/id