On wikipedia the MAX_INCLUDE_REPEAT limit (=5) in Parser.php is problematic. I propose to change the sens of this constraint from "max template inclusions" to "max different template inclusions".
To solve the memory usage problem, we could use a tempory table containing the previously loaded templates in the article ? So, each template replicated x time in an article would generate only one SQL request.
An opinion ?
Emmanuel Engelhart