Guided by Guardrails: Control Barrier Functions as Safety Instructors for Robotic Learning