Understanding topology for EMI supression in a power supply
The cap provides a return current path for leakage capacitance from primary to secondary side. L1 is not involved in this. This current will flow one way or another whether the cap is installed or not. Installing the cap allows you to reduce the loop area drastically from what it could potentially be without the cap installed.



To quote Rohm semi

"Y-capacitor added between primary and secondary sides;
A capacitor called a Y-capacitor is added between ground on the primary side and secondary side. This is one typical method for reducing the common mode noise caused in the secondary side by primary side switching noise via the capacitance across the windings of an isolation transformer. The voltage rating of the Y-capacitor must be equal to the insulation voltage of the transformer"

If you want additional EMI mitigation you can install common mode chokes on the input and output cables. Here is more information in the EDN article that the picture comes from.

How to achieve low radiated emissions with fully integrated data and power isolation