Understanding Classifier-Free Guidance: High-Dimensional Theory and Non-Linear Generalizations