Primordial magnetic fields from preheating at the electroweak scale