ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement