Only wrong if you want to prolong housetraining? Make your dog scared to shit in front of you, or if you do it after the fact (even just a few minutes after the fact) they have no idea why you’re mad, so you’re just scaring a dog for no reason. Ignore accidents when they’re little. Once they’re older, and know better, then yes, it’s not bad to punish a dog for going in the house – if it’s intentional, and not due to you making them hold it/illness/fear/etc. which would be crazy rare.
But what do I know? Just worked at a shelter for years where all those dogs who got their faces shoved in shit and piss came back for not being trainable, because they were too afraid to go in front of their owners and ended up holding it until it was too late or hiding (in the house, usually!) to go when no one was looking.
Really, it’s just lazy fucking pet ownership. There are much better, more efficient, less assholey ways to housetrain a dog, and it’s not like they’re some big secret.