More likely, it was pain from his sheath trying to slide down his overly dry penis and instead "sticking" - sorta like how your lips might stick together and be an "OUCH!" when you unstick them. A *VERY* common occurrence for "rookie" dogs who pull out either fully knotted, or knot up after pulling out.
If/when there's a next time, and assuming he'll let you (be careful - the "ouch factor" may be enough to cause him to snap at you if you try to approach his penis) you might try drizzling barely-warm-to-the-touch water over his penis to keep it moist until his knot deflates and shrinks enough so that he's able to re-sheath. Otherwise, the best bet is just plain leave him alone and let him deal with licking it down and getting it "back in the wrapper", regardless of any "complaint" noises he may make. If he's still not re-sheathed after about 20 minutes or half an hour, there may be something going on that he can't handle, either on his own or with your help, and you may need to get him to the vet. If there's any questions about "how'd this come about?", the simplest response is the best: "Idunno - I was in the kitchen doing dishes when he started yelping in the living room, and when I went to see what was going on, found him with this tumor-looking thing on his belly, and him licking at it and yipping like it hurt."