Is there a 24VAC transformer for a thermostat, that fits in 1-gang wall-cavity?
Any transformer you use needs to be listed specifically for use in 120VAC wiring subject to the National Electrical Code.  Do not use some random transformer out of an electronics supply catalog, even if it is UL listed as a component. 

One of the Code requirements is that high voltage and 24VAC must be separated by a divider etc. 

Generally these transformers are readily available in forms which solve that problem.  For instance, a common form is a transformer built into an electrical box lid.  The low viltage terminals are on the outside of the lid, solving the separtion problem.  

I see these often as 2-gang box covers (4”) and I swear I've seen them in a 1-gang (2”x4”).  We're not a product recommendation site but your question is do they exist; the answer is yes.  

Phase issues

The problem you have adding a second transformer is phase.  The two transformers will both be attached to R.  If your transformer is out of phase with the furnace transformer, that means there would be 24v between your C and R, and another 24v between R and W when the furnace is off. So the thermostat would see 48V between C and W.   You'd need to check with the thermostat maker to see if it can handle that.  

May not need C

Some thermostats (perhaps not yours) can also scavenge the power they need simply by being in series with the two wires R and W.  They do not need a C wire.  However this trick only works if the furnace's control relay draws a fair amount of current.  If it is too efficient, the thermostat can't scavenge enough power to function, and then they give you the advice to get a C wire. 

So, you can fix this by making your furnace relay less efficient.  I would say put a resistor in parallel with W and C on the furnace, except for that "must be listed" rule.   So, use a furnace or air conditioning relay, which are readily available.  Make sure your furnace's transformer has enough power to drive it. The purpose of the relay coil is to waste energy; the contacts are connected to nothing.