Some kids just aren't ready, developmentally or emotionally. If he knows he has to poop and he is refusing to sit on the toilet, there may be a sensory issue involved, or there may be a defiance issue.
The point is, what are you going to do about it? You cannot control what they do in the bathroom and you cannot make him sleep. You can't even make him eat. You have to offer the simple choices, and take the drama and the battle of wills out of it.
So, he chooses underwear or pull-ups. Either way, he chooses the personal care associated with it. So you teach him to clean himself, same way and with the absolute absence of emotion you would use to teach him to put away his clean socks and put a dish in the dishwasher. Practice this on your own in the mirror so you can do it without frustration. "He's how we get rid of poop, honey" - and basically, the poop is going in the toilet one way or another. Either he puts it in there by sitting, or he puts it in by dumping it from his pants. I would cut up an shower curtain (or buy/cut a couple of liners) so it fits neatly around the toilet and covers the floor in that area, And put a covered bucket or lined step-can in the bathroom for his undies or used pull-up. Practice it with him a few times, then he's on his own. What he cannot do is throw all the poop in the trash or washer. Imagine you are teaching a personal care attendant how to deal with changing an elderly or ill adult - take the "babyish" thoughts out of it and say that this is how big people deal with poop for those who cannot use the toilet.
And of course teach serious hand washing, which all your kids should do, lathering and rubbing while they sing the ABC song in their heads, twice. Make it clear this is a post-potty action as well as a pull-up/underwear response.
I'd skip the super praise when he uses the toilet, and I'd skip the super frustration when he doesn't. Be more matter-of-fact and let him make his own best decision, which includes the follow through. This will be a great way to handle a lot of other things as life goes on.