Yes, Jesus not only “set the example,” but took the punishment. In essence, Jesus was stoned to death in our stead, so that those who hide themselves in Him would no longer receive such punishment.
I was referring to “Let he who is without sin cast the first stone”, but what you said is true also.