fix stack level too deep error when digesting recurisve templates

I have a RABL template which sometimes extends itself in a `child` block.

With caching enabled, this blew the stack with an infinite recursion. 

I made the smallest change I could to prevent that from happening.

Note however that this has been fixed in a more complete way in `ActionView::Digestor`, which has also been updated to be thread safe (see here: https://github.com/rails/rails/pull/11664).

This patch should thus be seen as a temporary solution until the updated code can be integrated from `ActionView::Digestor`. I haven't done that myself because I didn't want to mess with code I don't know well.