Contextual Filters in a 'Tree-style' View
I found a rather clean and intuitive solution, however I am very interested in other, more straightforward answers if they exist.



I created a new Computed Field, called parent_project_computed field which:


calculates the parent-project based on the parent_main_task
field(which is entity reference) if it's a Sub Task content type
calculates(basically just copies) the parent_project field if
it's a Main Task content type


This way both the Main Task and Sub task have a field which stores the nid value of the Parent Project. Then I use a contextual filter based on this new parent_project_computed field and both content types match this filter so they show up in the results just fine.

This is the PHP I wrote within this new computed field:

$entity_field[0]['value'] = null; //initial value null, should get overwritten in IF's below

//if field_parent_project exists just copy it's value
if (array_pop(array_pop(field_get_items($entity_type, $entity, 'field_parent_project')))) {
   $entity_field[0]['value'] = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_parent_project')));
}

// if 'field_main_task' exists get it's value, load the node and get the E-R value within it
if (array_pop(array_pop(field_get_items($entity_type, $entity, 'field_main_task')))) {
    $nid = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_main_task')));
    $node = node_load($nid);
    $info = field_get_items('node', $node, 'field_parent_project');
    $entity_field[0]['value'] =$info[0];//ER fields store data in array, since this is a single value ER field it always sits at position '0'
}

//Note: E-R value means Entity Reference value.


If the PHP code can be made more, err bulletproof, I'd appreciate a comment below. 
Thanks.

Update:

On saving each Task you need a post-save custom hook to reload and resave all the Subtasks in order to update their 'Parent Project' computed field which has now changed. We've used this module which provides some nice additional post-save hooks and some more.