Learning to Align, Aligning to Learn: A Unified Approach for Self-Optimized Alignment