How can I remove posts of a certain category from homepage after a specified time period?

This looks straightforward, but unfortunately isn’t, because wp_query doesn’t allow you to exclude posts on basis of multiple arguments (in this case category and date). You can select on basis of multiple arguments, but not exclude. So, to do what you want, you must in some way bundle your two arguments into one. Conceptually, you select the posts you do not want and then use that list to exclude them on basis of their ID’s. Here we go:

add_action ('pre_get_posts', 'wpse308323_multiple_exclude', 10, 1);
function wpse308323_multiple_exclude ($query) {
  // only do this on home page for main query
  if ( $query->is_home() && $query->is_main_query() && ! is_admin() ) {
    // define posts to exclude and get them
    $args = array (
      'category_name' => 'third-party',
      'date_query' => array(
        array(
          'before' => '2 weeks ago'
           )
        )
      );
    $q2 = new WP_Query ($args);
    // extract an array of ID's from the posts retrieved in $q2
    $q2_ids = wp_list_pluck ($q2->$posts,ID);
    // exclude these ID's from the main query
    $query->set ('post__not_in', $q2_ids);
    }
  }

Disclaimer: above code is given to show the concept. I haven’t tested it, so debugging may be necessary. Some references:

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.