Support extending system templates with the same name

Would make it possible to create a custom template extending a template from system/modules and at the same time overwriting it by giving it the same name. For example `templates/fe_page.html5`:

```html+php
<?php $this->extend('fe_page'); ?>
<?php $this->block('body'); ?>
  ...
<?php $this->endblock(); ?>
```

This would result in an infinite loop in the current implementation.