Snippet to programmatically set the frontpage
\Drupal::configFactory() ->getEditable('system.site') ->set('page.front', '/home') ->save();