Getting subpage of subpage – Custom posts

The problem is here

$subpages = get_pages( array(
'child_of' => $pageId,
'sort_order' => 'asc',
'sort_column' => 'menu_order') );

‘child_of’ parameter also queries for the grandchildren along with children. Use the ‘parent’ parameter instead which will only query for the direct children. Once this is done, you’ll use the same code in your foreach again

foreach($subpages as $page) {
    $subsubpages = get_pages( array(
    'parent' => $page->ID,
    'sort_order' => 'asc',
    'sort_column' => 'menu_order') );

    // use $subsubpages along with $page here
}

If you want to go even lower in levels, you will probably want to implement this logic in the form of a recursive function