The information about the parent product is stored in the property 'product_options' of the order item object. You can retrieve the right parent id for every order element by executing this code:
foreach ($order->getAllItems() as $item) {
$options = $item->getProductOptions();
$parentId = $options['super_product_config']['product_id'];
}