Police have charged a man after he allegedly made a threatening gesture to two men, including a worshipper, at a synagogue in Sydney's Upper North Shore.