This is a thoughtful take, Jeremy. My hesitation to congratulate someone on significant weight loss is usually because I don't know whether the weight loss is intentional. I would feel terrible congratulating someone on obvious weight loss if it was due to a serious illness, severe depression that robbed the person of their appetite, or some other situation other than a deliberate and careful exercise/diet plan.
I try to not comment on someone's appearance at all unless it's to admire something they chose (e.g., I love your shoes, you look great in purple, what a cool hat). It's worked for me so far!