collider – How to prevent the OnTriggerEnter2D function from being called for specific pairs of Layers in Unity?

How to prevent the OnTriggerEnter2D function from being called for specific pairs of Layers in Unity?

Is there maybe something like a trigger matrix similar to the collision matrix?

To avoid the x-y problem, let me describe my use case.

I have a lot of different colliders and triggers in my game. There are pairs for which I am interested in the OnTriggerEnter2D and the OnTriggerExit2D to be called and those for which I am not interested in calls. I can check the pairs inside the callbacks of course. But I thought if there is a better way to do it?

I do not have a specific issue in my case, I just want to broaden my knowledge. Since I can achieve the desired result for the OnColliderEnter2D and the OnColliderExit2D with the collision matrix, I thought that maybe the same can be done in the triggers case.