Facing high costs and falling demand, German manufacturers are reinventing themselves to tap in to the country’s accelerated rearmament.