Messing Up Parenting

I think I’ve messed up my 5 year old. He’s really the sweetest kid, but does have an awful attitude sometimes. But the point is, I feel like I’ve created an anxious, people-pleaser child. He is an absolute angel at school and extra curricular things, and I feel like that’s because he thinks he has to do everything perfectly. He gets upset as soon as he is in trouble for something. But then he’ll turn it around and say “just put me to bed then”. Or “I’ll just have quiet time for like 4 hours then”. Which has never happened, by the way… Most times we would just talk to him, maybe send him to his room to calm down if it’s really bad, but we have sent him to bed early before due to attitude.

Anyway, when I am getting upset or frustrated, he’ll tell me “I know when you’re mad mom. You’re mad.” And I try to explain I’m just frustrated with his behavior, but it’s like it doesn’t matter how I explain it, he’s still thinking he’s the worst kid ever because of MY feelings. But then he’ll also say mean things to me or his dad.

What am I doing wrong? Please help. I want him to be confident, but also well mannered and kind and it’s like I can’t find a balance.