There's nothing wrong with re-painting an old transformer.
Re-painting electrical components such as transformers, coils, electric motors, etc. is done everyday within the electrical apparatus repair industry.
Is this a transformer you can easily remove from the chassis? Is it a style where stamped covers protect the winding, or is it an open paper arrangement? The key word using sand paper, is to use some form of garnet paper and not emery cloth which has conducting particles in its "dust".
And that obviously you have a means of removing the created dust before applying the paint.
Here's the disclaimer and fine print note: Build up of paint (meaning the item has been repainted over time with no attempt to remove previous
coatings) can become an insulator creating an increased operating temperature for the device. Unless the transformer was designed at a some
"save-a-buck" minimum threshold of operation, and already has a high operating temperature, you may want to leave it alone.
Any paint applied to it could become discolored as well due to heat.
Put some paint on it. It will look great.
John