Most doorbell transformers are placed in garages on cielings or near
electrical panel or even in them
Yes, that is true, but does that make it an acceptable installation?
I would think it would depend where you live. I mainly see them next to the service panel or at an electrical junction box at the basement floor joist.
I’ve seen them all over the place. Pretty common to see them on the ceiling of the basement wired into a J-box or a ceiling light.