Yes, it does look like an extreme case of prolapsed rectum, I have never seen one that bad. The white stingy poop was probably a protozoal infection like hexamita, a bad case of that can cause the tissue holdi=ng the intestines in place to soften and even without that, think of what happens to you after several days of diarhea, especially after being constipated.
I am afraid the prognosis for your fish is not very good, clean water and something like stress coat can help. It might retract on it's own or you can try to gently press it straight back through the vent, use surgical gloves so as not to further damage the tissue. This often works for much less severe cases but in this one it is doubtful.