Prevent infinite recursion

http://manage.dimagi.com/default.asp?146270#816092

Looks like this was introduced in #4677 

Tested this by loading multiple modules/forms on HQ. newmattproject loads really slowly locally, but it looks like it's just an issue with that domain and not with other domains I have.

Don't think any tests hit this either.

@nickpell