Your dog isn't urinating inside to be spiteful.
Rather, your dog could have a medical issue, such as diabetes, that causes it to urinate frequently due to increased water intake.
Your dog probably knows it should urinate outside, but it may still need to go after coming back inside.