Avoid pages losing template association on site re-deploy

It is impossible to guess how it breaks. Page template choice is stored in meta. Why would meta break? Who knows. Also who knows what else breaks that you might not be noticing.

The best advice to look into breakage would be to look into it right away when you hit the issue next. Look at the source site that works, look at the destination site. Compare the heck out of everything.

As a more general advice if you depend strongly on integrity of template assignment you may want to move away from managing it in interface. You can use page-$slug.php and page-$id.php paths of template hierarchy to hardcode those choice for example.