Bubba, occasionally, has the same problem. Is your dog neutered? Bubba is but after dinner, every night, he likes to dominate his bed
So when we do his sanitary trim we shave up to his rib cage on his belly but we leave a little pee string.
If he has this problem again try to get all the hair unwound before cutting it so it doesn't go inside with the penis. There are many suggestion for getting the penis to retract. But leaving it exposed for long periods of time can cause problems.
Welcome to YT and thank you for rescuing him.