ISTANBUL — As a rebel faction of Turkey’s military began a violent attempt to topple the elected government, the country’s top officer, Gen. Hulusi Akar, was held at gunpoint in his office in the capital and told for the first time about what was happening.