I don't think that something to change the listing query would be the best solution here. For sure it will add an overhead.
I think a better approach would be to create an observer that assigns automatically the products to all categories.
Case 1:
You want all the products from category 1 to be assigned to all subcategories:
Add a category yes/no attribute called show_products_in_child_categories
(or find something shorter).
Create an observer on the catalog_category_save_after
.
If the category being saved has this attribute set to yes, assign all its products to all it's subcategories.
public function saveCategory($observer)
{
$category = $observer->getEvent()->getCategory();
if ($category->getShowProductsInChildCategories()) {
$childrenIds = Mage::getResourceModel('catalog/category')->getChildrenIds($category, false);
$productIds = $category->getProductCollection()->getAllIds();
//for performance reasons you can insert directly in the table `catalog_category_product` each combination of $childrenIds X $productIds skipping the existing ones.
//Use `INSERT ... ON DUPLICATE KEY UPDATE...`.
}
}
Add an observer on catalog_product_save_after
that checks if the categories the product is on has that attribute set to yes. If so, assign it to subcategories.
Case 2.
Only some products from category 1 should end up on all subcategories.
Put a yes/no attribute on the products. assign_to_subcategories
.
Then do the same thing as above, but filter the products on the category save observer by this attribute ->addAttributeToFilter('assign_to_subcategories', 1)
.
Sorry, I don;t have a fully working solution. Just an idea that should get you where you need to go.