This is not a good practice. If the transformer fails, you would have to remove the conductor and disrupt it's loads in order to replace the transformer.
I agree, no foreign wires are to be passed through the transformer. I expect that there will be many who wear the AHJ hat that will agree. It is also common knowledge that all conductors are not to be passed through an area that originates in the top section -- the label in the transformer enclosure will cleary identify this and other restrictions.
I also agree, not a good practice. I think the original questions infers that the poster wants to know if it is a code violation. I don't find a violation.