A retired diplomat quoted frequently by Conservative cabinet ministers as they try to defend the government’s handling of detainee transfers in Afghanistan was himself closely involved in developing the policy governing those transfers.