It is the Pokemon being checked for. The Defending Pokemon is the target of the effect of the attack. When ituses magical charm, it effectively registers the defending pokemon as the one that sylveon takes 100 less damage from. If another Pokemon switches in, it's almost certainly not the target. Therefore, Magical Charm will not prevent damage from other Pokemon.
I kinda see this as a way to let Metal type Pokemon do more damage, as if the effect applied to the Active, metal mons would do 100 more before Weakness. So say it does 160 x 2 = 320, itd instead do (160 - 100) x 2 = 120. With the after though, it instead does (160 x 2) - 100 = 220, which is much more. Notably, this means that 190 and above from a metal mon would OHKO sylveon, where if it said before Weakness, it would have to be 240!
I dont think this has really been done before though, so there could always be some weird ruling or translation error too.