How to overwrite template file using php?
Hardcoding cusomised templates into extensions is in breach of extension development standards and can break on upgrades. Prevention of errors is an important priority to most developers to take pride in their craft and care about their clients.

The answer in your extension is to include the modified file in the path form template/CRM/path/to/template.tpl.php - but please find a better way. Civi users deserve great products that they get from other services, not this.