[xml-fold addon] Prevent infinite recursion from weird lastIndexOf behavior

Issue #1625