The reason he doesn't go in his crate is because he has learned that the crate is his bed, his home, his "area". Dogs won't go where they sleep, and since the crate is a small area, if he goes there he can't move away from it. He is going when he's gated in the kitchen because he a) hasn't learned that he isn't supposed to go there, b) it's a big enough area that he can get away from it, and c) he probably doesn't like being confined away from his people. It's not a spite thing, it's more an anxiety thing, and he doesn't know any better yet.
For five months, he sounds like he's doing a pretty good job, really. He's letting you know when he has to go out, he's mostly going when he is out, and that's pretty good for such a young puppy.
As for the backyard, I would suggest that until he's older (and bigger, if his adult size will stop him from getting out of the fence) you should take him out on a leash. He should learn that when he goes outside, the primary purpose is for him to go to the bathroom. Keep him on the leash until he does, and then give him TONS of praise and good boys - then you can let him off the leash if you are going to be outside monitoring him, and give him lots of playtime. That way he learns that when he goes outside, bathroom comes first, and then he gets to play.
If you can't stay outside with him to monitor him, or if you're worried that he won't come back even if you are there, then keeping him on a leash will help you get him back inside. Then he can get treats and good boys and playtime and praise for coming inside after going to the bathroom, which teaches him that routine as well. I did that with my dogs, and they got to the point that I didn't even have to call them back inside. When they finished going, they came back to the door by themselves.
This will also help him learn that outside is the only place he is supposed to go. If he goes in the kitchen, and you can catch him in the act, make a loud noise (clap your hands or something) and say loudly and firmly "NO!" This will usually startle the puppy into stopping what he's doing - then you pick him up and bring him outside right away, and don't let him come back inside until he finishes his business. If he goes in the kitchen and you don't catch it until after the fact, you can't really do much. The putting-his-nose-in-it thing doesn't teach them anything except that those smells somehow make him a bad dog. He doesn't associate them being there with the fact that he put them there.
Using a leash, you can also teach the dog your property boundaries. Walk him around the border of the yard on the leash, and if he steps outside the boundaries, or tries to get through the parts of the fence that aren't sealed, you correct him by pulling him back into the right area with the leash and saying "No" or "Stay in the yard" or whatever works for you. When he is staying inside the boundaries, give him constant praise. When he walks by an unfenced area and doesn't go through it, give him tons of praise. Give him immediate correction when he goes outside the boundaries, though. After a little while, he'll learn where he can and cannot go, but I wouldn't let him stay back there unsupervised until he's through his "terrible twos" (yeah, dogs get them too, and they can be a real pain!)