you can use one, but three things come to mind: 1 ,generally they are pretty poor transformers, very high core losses, they will draw appreciable power with no load, 2 the physical shape is designed around the case they go in, often round, etc, and hard to mount other than in the lamp case and this physical restraint usually contributes to problem # 1, problem 3 is that they are most likely what is called Class 2 - they have a fusing wire built into the primary winding that will open circuit on overload. If you short the output winding or overload it, the link opens and the transformer is a paperweight. i have seen outputs from these devices that are into core saturation, full of harmonics, not good either.
basically they are designed to fulfill their purpose an nothing else.