Imagine Ron and Harry having a sleepover and before going to sleep Harry jokingly says "aren't you gonna give me a goodnight kiss?" and Ron just goes and kisses his forehead. No hesitation, no big deal for him.
And he doesn't know it's the first time someone gives Harry a goodnight kiss since his parents died.
And it's natural to Ron because at this point Harry is family. He used to kiss little Ginny's forehead like he observed his family did, stopped when they were teens cause they both would cringe. But Fred and George used to smooch everyone's heads out of nowhere (usually after successful pranks) laughing. Bill kissed Fleurs temples when they had to quickly part. Charlie, after Ron listened to him talk about dragons for hours and engaging in conversation, 'thanks' and kiss on the forehead before ruffling his hair (which is also a thing between Weasleys siblings! Harry got his hair ruffled all back in 1st year and even if it's headcanon created by movie scene (at the end of one movie one of the twins pats Ron's head while he's petting Harry's) I absolutely love it) Arthur would come to check up on his sleeping children after long day of work, giving forehead kisses as goodnights. And Molly oh of course Molly would give kisses any any gives occasion, cheeks to greet you, brows when you were sick and forehead for good dreams. Even Percy! Fred and George would tease him "no kiss goodnight?" so eventually he gave up fighting and was just giving it to them.
So when Harry teases him it seems most natural to lean in and give him kiss goodnight.
Cause that's what family does. He doesn't question it, it's like helping to set the table, borrowing your siblings' stuff, shaking hands when you greet someone.