Probably the triac is driving the transformer with a square(er) wave. Mains will be a near-perfect sine wave. A square wave will create more noise due to the much shorter rise time.
You can attempt to mitigate noise by damping the transformer, eg heatshrink, epoxy, hot snot, etc. (keeping operating temps in mind)