TACOS: Topology-Aware Collective Algorithm Synthesizer for Distributed Training