This happens regardless of allies or enemies. Medics do "fake" infinite shots, which everyone can see or hear.
Same with engineers, it comes from using the repair or medical applicator, the animation of the tools puts the gun sound and animations in a loop. Medics and Engineers been broken as long as I can remember. This has been ongoing for years ever since DX11, that they have never fixed. I’ve reported this numerous times, even as it occurs.