Well, I'm just going to give you my thoughts and predictions on this, so it might not be 100% accurate until we see what happens next episode. In the novel, TTJ used the puppet spell on YXW to kill XL because the war btwn Jing and Sheng countries was still ongoing and they (TTJ & YXW) were still enemies at this point. In the drama, this has been completely changed.
Now onto the drama. From what we've seen in the latest episode, TTJ is going to end up believing that YXW wanted to kill him with poison (added by YBC) and run away with XL. Perhaps he'll believe she never actually loved him and betrayed him once again, just like everyone else in his life. Now, I know we've seen TTJ be nice for some time now, but he's still extremely ruthless to those that betray him. Therefore, probably in his anger towards YXW for "trying to kill him for her real lover (XL)", he'll use the puppet spell to get revenge on her (and XL). It's obviously a harsh response, but knowing how he is and how much he's been betrayed, it makes sense for him to react that way (and he also is going to believe YXW wanted to kill him as well so an eye and for eye and all that lol).
I'm not sure when the Tower Scene is going to occur but from the trailer for episode 25, I got the sense that he realizes this was YBC's plan (at least the poison part). So perhaps he ends up regretting putting the puppet spell on YXW but it's too late. Idk we'll see what happens!