The reason the rascal pig appeared here was entirely a plan Su Pan'er had thought of from the beginning.
Bald Donkey Liao Jue was highly skilled, and from the way he had attacked her initially, it was clear that she was no match for him.
Since she wasn't his match, Su Pan'er had no intention of fighting him head-on. She thought of the rascal pig, whose skills could, with their combined effort in a fight, catch Liao Jue off guard and potentially subdue him.
Therefore, she kept the rascal pig by her side and specifically ordered it to conceal its movements. After climbing up the Bell and Drum Tower, she led Liao Jue into conversation to buy time for the rascal pig to get ready.
Luckily, Liao Jue's attention was drawn to her, leaving him unguarded against the hidden rascal pig, which allowed their attack to be effective and barely managed to control Liao Jue's consciousness.