I think you're looking too much into this. I can't speak for everyone, but for me cosplay is just fun. I enjoy testing my skills when I make my costume and I enjoy showing it off by wearing it. To me it's wearable art. I don't think you have to have a self esteem problem or have to want attention. Personally, I could care less if anyone takes notice, however it is rather nice when someone comments nicely on your work.
Is it an escape from reality? Hmmm...no more than a vacation would be, I think. As I've said, I cosplay for fun (even if my first time was rather forced.) and I only cosplay at cons. I love going to an anime con because it's like a mini vacation for me. I really don't count that as an escape from reality, just an escape from everyday stress.