Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 36074)
+++ src/wp-includes/post.php	(working copy)
@@ -4286,6 +4286,8 @@
  * Sub pages will be in the "directory" under the parent page post name.
  *
  * @since 1.5.0
+ * @since 4.4.0 Do not add parent slugs to orphaned pages 
+ * @since 4.4.1 Do not add parent slugs when the parent does not exist
  *
  * @param WP_Post|object|int $page Page object or page ID.
  * @return string|false Page URI, false on error.
@@ -4300,7 +4302,7 @@
 
 	foreach ( $page->ancestors as $parent ) {
 		$parent = get_post( $parent );
-		if ( 'publish' === $parent->post_status ) {
+		if (!empty( $parent ) ) {
 			$uri = $parent->post_name . '/' . $uri;
 		}
 	}
Index: tests/phpunit/tests/post.php
===================================================================
--- tests/phpunit/tests/post.php	(revision 36074)
+++ tests/phpunit/tests/post.php	(working copy)
@@ -674,8 +674,8 @@
 		// try the child normally
 		$this->assertEquals( 'parent/child', get_page_uri( $child_id ) );
 
-		// now delete the parent and check
-		wp_delete_post( $parent_id );
+		// now delete the parent from the database and check
+		wp_delete_post( $parent_id, true );
 		$this->assertEquals( 'child', get_page_uri( $child_id ) );
 	}
 
