J.
it may be possible that if they moved from a place with dad he is a youngster voicing his disdain with sudden changes that are not too comfortable for him by making the choice to voice the word no. He is probably letting the world know that he is at his personal limit. little ones have them too. this will sound dramatic and tramatizing, but it worked and I only had to do it once so think hard about the effects on your little one before you try it.
My son got some very bad things in his ears that came out of his mouth from being on the playground when he was a little one. when i noticed it, and was sure of what he was saying, I sat down on the couch and covered my face with my hands and pretended to "boo-hoo" cry so hard that he came over and tried to console me. I told him no hugs, because his bad word made me feel sad and that the bad words in his mouth was going to make his tongue disappear and I did not want that to happen to him because I loved him and I loved talking to him. I told him the bad words made me afraid. He tried to hug me harder and said, no more bad words mommy, no more bad words. I hugged him, kissed him and sad thank you. that cured that, with my grandson who is now 5, I told him that I was going to tell his grandpa when he came home from work and that grandpa was going wash the dirty word in his mouth out with soap. he continued on about a week or so later, he said the s word and I looked at him and said, "oooooooooooooooh, that was a bad word." and I had a look that was serious. He understood and stopped. (may work with I hate you. he needs to understand the power of those three words and the sting they can bring to others.)
(I'm a drama queen I know.), I think that if you try to have him replace thank-you with no, it could change things, make up a game with his favorite toy and hand it back and forth saying thank you, a cheap dollar toy or little surprise that you will not give him when the no word appears, he will catch on, do this with a cookie or treat shortly afterwards, and withhold it if he does not say thank you instead of no, it's a shot in the dark but give it a try. do not reward bad behavior. you will find a way. I know you will, you are a good granny. tried to compile both request in one here, hope you understand.
little ones come with phases also, this too shall pass just be vigilant and firm, remain calm, he knows about cause and effect. all little ones do.