Theland - // A deterrent? //
Possibly - but in the same way that I believe that Capital Punishment is not a 'deterrent', and for exactly the same reason - I don't believe that anyone embarks on a career as a spy expecting to be caught.
But more likely in the case of a spy, the risks of being found, and the consequences, will have been explained in advance, so anyone who continues is aware of what they are getting into/