Shadow Precision Issue - Cycles

After tracking a live footage and setup a tracking scene, Blender automatic create a compositing script separating shadows (background) and objects (foreground). But after some projects I noticed that shadow alpha is more accuratte if ambient occlusion and all parameters but camera from ray visibility are disable in world properties tab. When view layer is switched those properties remain untouched. So now I duplicate Blender files and configurate one file for objects and other only for shadows. I would like to know if it’s possible to lock world properties to a layer in a similar way for render layers, or to create a only shadow render pass.

Those examples are still images, but same compositing script as a tracked footage.

Low quality shadow:

High quality shadow: