Prevent posts with certain post_meta to be edited

I think an elegant way to accomplish this would be to hook into map_meta_cap and deny users as though they do not have the capability to edit the post. This should also gate any other potential work-arounds, such as modifying the post through the REST API or direct POSTing. As an added benefit, it will also take care of omitting the edit links such that you don’t need to include your current solution.

add_filter( 'map_meta_cap', 'wpse405452_restrict_global_post_editing', 10, 4 );

function wpse405452_restrict_global_post_editing( $caps, $cap, $user_id, $args ) {
  if( $cap !== 'edit_post' )
    return $caps;
  
  $post_id = $args[0];

  if( get_post_meta( $post_id, 'global_post', true ) )
    $caps[] = 'do_not_allow';
    
  return $caps;
}

An introduction to roles & capabilities can be found in the Plugin Developer Handbook