WASHINGTON—A course for U.S. military officers has been teaching that America’s enemy is Islam in general, not just terrorists, and suggesting that the country might ultimately have to obliterate the Islamic holy cities of Mecca and Medina without regard for civilian deaths, following World War II precedents of the nuclear attack on Hiroshima or the allied firebombing of Dresden.