Three of the top cybersecurity officials at the Federal Bureau of Investigation are retiring from government service, according to people familiar with the matter—departures that come as cyberattacks are a major concern for the country’s security agencies.