Ignoring collision on a specific parent or a tagged object

I have my level spawning around my player as he goes, as such the enemies are inside the levelpieces that are spawned, as well as several other things

Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);

that line works for the players collision to be ignored by his own projectiles, but all the enemies look to the root of the levelpiece for a collider, how do I make the enemies only look for a specific object to ignore collison on, or say a tagged object like other enemies, or just its own parent.

Nevermind, fixed it with a messy quick fix for now

Physics.IgnoreCollision(instantiatedProjectile.collider, transform.parent.transform.parent.transform.parent.collider);

I just go several parents up for now but I will have to make it more precise.