Ok so I had the same issue and could not change any meta data on old published pages only new ones.
So this fix worked for me…..
The problem is the _wp_page_template in the wp_postmeta table. This was being saved to a previous themes template name.
You can change the following line of code in wp-admin/includes/meta-boxes.php:
if ( ‘page’ == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {
on line 742 to the following:
if ( ‘page’ == $post->post_type ) {
This will force the page attributes to display “Default Template”. When saving the page this will then update the value in the DB.
The actual line which causes the problem is: $page_templates = wp_get_theme()->get_page_templates( $post ); which is in wp-includes/post.php. This returns blank and then fails to run update_post_meta();
Hope this helps you.