Any issues wiring bathroom exhaust fan to low-voltage heated mirror?
You can have a removable access panel to mount the transformer in the wall if it is rated for being enclosed. Some transformers are not listed for being enclosed. Most transformers similar to this are mounted on a junction box with the 120v inside and the low voltage on the outside in this case a full wave bridge may be integrated in the transformer or connected to it and the 24vdc is taken to the mirror for the heat and light.
I make “picture frame” access panels I have always used Velcro to hold them in place. An inspector did recommend screws as they are allowed. Removable panels designed for access that do not damage the finish are code compliant.  So if the transformer is allowed in a stud bay you could create a “picture frame” attached to the Sheetrock but the frame covers the seam. Velcro or screws can be used to hold this in place.