Self-Correction is More than Refinement: A Learning Framework for Visual and Language Reasoning Tasks