contextify: handle infinite recursion errors

Try to be consistent with v0.10 and emit "Maximum call stack size
reached", even if it happens when allocating context or doing other
stuff.

fix #7045
Merge remote-tracking branch 'upstream/master'