Nested Matrix functionality for one block type using Tags
I just tried to replicate your setup (in simplified form), because I thought this is in fact an interesting and creative approach
to do Matrix nesting that might come handy.

Here's my code that works great for me. I hope it helps, even though I actually don't see the difference to what you have?!

{# Go through our Main Matrix blocks #}
{% for block in entry.mainMatrix.type('mainRelationsBlock') %}

    {# Get the tags selected in the Main Matrix block #}
    {% set tagsToFind = block.mainTags %}

    {# Try filtering Matrix blocks of our Sub Matrix using `relatedTo` #}
    {% set relatedBlocks = entry.subMatrix.relatedTo({
        targetElement: tagsToFind
    }) %}

    {# Show them #}
    {% for relatedBlock in relatedBlocks %}
        &lt;li&gt;{{ relatedBlock.text }}&lt;/li&gt;
    {% endfor %}

{% endfor %}