
I tend to go with a problem with the anal glands when this happens. They can become inpacted/infected although with most dogs, provided they have a normal formed stool this shouldn't happen and the glands never needing to be touched. Once they do, it can take a while for them to settle down again and if there is infection, that too may take a different antibiotic to work. Did your vet treat with antibiotics, and pack the glands rather than orally because oral treatment has never worked, with mine when they occasionally have this problem. It's strange that your puppy is now doing this but he too may have impacted glands. Have they been loose (stools) of late?
When this happens, you probably need to look to their diet or this will only keep happening otherwise. Working as they should, expelling a bit of the fluid in there with the passing of a normal stool, you shouldn't have this problem.