BERLIN—A 16-year-old boy was detained Thursday in connection with a possible plan for an Islamic extremist attack on a synagogue in the German city of Hagen, authorities said. The detention took place on Yom Kippur, the holiest day in Judaism, and two years after a deadly attack in another German city on the Yom Kippur…