[BUGFIX] Do not consider directories ending in .tmpl

Change-Id: I369f66c78182c796a2bb9d676b9d01fe98e6748b
Fixes: #59356
Reviewed-on: https://review.typo3.org/30579
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers