my installer uses the same mechanism as VB installer(upgrader). the string:
PHP Code:
DELETE FROM template WHERE title='".addslashes($title)."' AND templatesetid=-1
makes it to be removed by any install(upgrade), so this is normal.
i have only one file with all the custom templates i made. when i upgrade or install, i simply run my installer, so all templates are updated in 5sec.

i hope this info is useful to you.