Fixes #906 and #884

This fixes #906, and, by extension, #884. The `ReferenceExpressionResolver`, which is responsible for turning references like `{{ foo[bar][i] }}` into keypaths like `foo.one.0` and re-resolving their mustaches as necessary, has been heavily refactored, and mustaches themselves are now effectively able to 'unresolve' if that's necessary.