How can I mount K-728 diverter valve without any clearance behind it?
I have to wonder if your next problem will be that the valves are too far back in the wall to install the handles when the shower walls are installed. My experience with shower valves (not, I admit, a huge number of them) is that they normally don't sit all the way back in a 2x4 wall cavity when at the correct depth, so there's normally room for a 3/4" board behind them to screw into, at least.

To directly address the mounting issue, assuming they are where they belong, depth-wise: You can either replace a strip of drywall behind it with a board (or plywood) so you have some wood to screw into, or use a steel bracket and machine screws - either one mounts to the studs.