Dashboard blocker on network multisite for specific user roles

All your role checks are relative to the user roles in the sub site in which I assume you are not a user. You should also check for is_super_admin()

  if( !is_super_admin() && (is_admin() && !defined('DOING_AJAX') && ( current_user_can('subscriber') || current_user_can('media') ) ) ){
    wp_redirect(home_url());
    exit;
  }