I guess it's partly a desire for privacy and partly social anxiety. Don't get me wrong, if I were about to shit myself I absolutely would use a public restroom. I'd just prefer to use my own bathroom.
Now matter how much you know that everyone shits, kids are fucking monsters and will never let you live it down, especially if you're not "popular" or able to play into it (anxiety) or just tell the kid to stfu (anxiety, size, intimidation).
I only held it in at school because my parents taught me that public restrooms are extremely dirty. It took a while to get over my phobia of public restrooms, but I needed to since it's gotten harder to hold it in (and it's bad to do so anyway). Reading some of the replies here, I knew kids were often psychos but sheesh.