Update the original fix for issue #24327 so that recursive elements are tolerated rather than fail. See gh-24327