Index: src/wp-admin/includes/upgrade.php
===================================================================
--- src/wp-admin/includes/upgrade.php	(revision 38086)
+++ src/wp-admin/includes/upgrade.php	(working copy)
@@ -90,8 +90,6 @@
 
 	wp_install_maybe_enable_pretty_permalinks();
 
-	flush_rewrite_rules();
-
 	wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
 
 	wp_cache_flush();
@@ -105,6 +103,15 @@
 	 */
 	do_action( 'wp_install', $user );
 
+	/**
+	 * Fire the init action then flush rewrite rules. Ensures 
+	 * settings are fully loaded before the next page load.
+	 *
+	 * @since 4.6.0
+	 */
+	do_action( 'init' );
+	flush_rewrite_rules();
+
 	return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
 }
 endif;
