First, Ajit Doval was in pakistan for 7 years (known), only 6 of that was with Indian embassy.
Second, Ajit Doval was a hands on operative who actually dressed up as a rikshaw puller and entered the Golden temple when it was take over by the terrorists. He in fact convinced the terrorists that he was a ISI agent
and he had planted mines all around the temple so that the IA could not come in. (hence awarded the Presidents medal)
He himself has shared stories about how he roamed undercover in pakistan.....etc.
I say this to explain to you that not ALL IPS officers are babus. There are plenty of hands on operatives who later on get promoted from the field into cushy offices. Same is true for the police and the Army. The point is that the real world is quite different from what you imagine it to be.
RAW not risking officials is as dumb as saying the IA do not risk officers from the NDA in operations. Both of them do.