The deal struck in August anchors Japan’s push away from its postwar pacifism to forge security ties beyond its alliance with the U.S. to counter China