How to remove `contain()` added to the query by a behavior in Cakephp 4?

I’m looking for the way to do an equivalent to cakephp2’s 'recursive' => -1 on a find().

I have a Model Categories that uses the TreeBehavior.

In my controller I get the path of the category :

// in CategoriesController.php
$path = $this->Categories->find('path', ['for' => $id]);

But I have the error message Unable to load Photos association. Ensure foreign key in Categories is selected

The problem is that find('path') above seems to try to find as well associated Model to Categories as Categories uses another behavior (AttachmentBehavior) that adds contain('Photos') :

// in AttachmentBehavior (that is used by `CategoriesTable`)
public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
{
    $query->contain('Photos');

    return $query;
}

How can I remove contain() in $this->Categories->find('path', ['for' => $id]).
Is there an option ?

I tried $this->Categories->find('path', ['for' => $id, 'contain' => []) but I have the same error…

In fact, I understand that Treebehavior::findPath() selects only lft and rght fields (for the categorie’s node) and not the foreign key as my AttachmentBehavior needs.

I made the choice to make contain() in my AttachmentBehavior::beforeFind() as there’s in fact many dynamic associations done in that method (not only ‘Photos’, ‘Photos’ was for example).

My AttachmentBehavior::beforeFind() looks like that :

public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
{
    foreach ($this->_fields as $field => $value) { 
        $query->contain($value['alias']); // How to make sure the foreign key is present ?
    }
    return $query;
}

Is there a way to modify my AttachmentBehavior::beforeFind() to make sure the foreign key is present ?