Does a golem’s magic immunity bypass its opponent’s defensive spells?

What happens if, for instance, a Golem tries to grapple a foe that had freedom of movement cast on it?

Immunity to Magic (Ex) Golems have immunity to most magical and supernatural effects, except when otherwise noted.

An iron golem is immune to any spell or spell-like ability that allows spell resistance.

Freedom of movement allows spell resistance, therefore the Golem is immune to it. However, the spell isn’t on the golem, even though it is affecting the Golem. Is there a clear rule/precedent for which way this would go?

My gut instinct is to say "yes, the Golem ignores your defensive spells". They may not be being cast on the Golem, but they are still "magical effects", and thus covered by the blanket statement at the start of the Golems entry. Also, I dislike that freedom of movement completely shuts down grappling as a viable strategy for both PCs and enemies at higher levels; SR and magic immunity bypassing it seems like an elegant solution.