Indirect query match / 2nd degree of "closeness"

Let me first explain what I mean by “closeness”. Here’s an example:
image

Between me and a product manager i work with there is a closeness of the 1st degree:
image

Between me and his A team there is a closeness of the 2nd degree:
image

It’s much easier for me to define what PMs I work with, rather than teams, since Product Managers can have 2 or even 3 teams attached to them. Which means my note links only to PMs, and teams are 2nd degree close to me.

I have this dataview query in every dev-team:

TABLE WITHOUT ID
file.link AS "Related people",
Team,
Position
FROM [[#]]
WHERE type = "person"

Each dev-team has this set of meta-data that describe it:

---
type: team
---
PM:: [[LINK DO THE PM]]

Whereas a note describing me has this:

---
type: person
---
Works-with:: [[LINK TO THE PM]], [[LINK TO YET ANOTHER PM]]

How can I rebuild the dev-team snippet to also include me, if I work with their PM?
Like so:
image