Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challenges