Is it ever recommended to get a colectomy for constipation?

Yes, for Certain dx. Constipation, common problem that is managed by medicines and diet the vast majority of the time. For certain conditions (colonic inertia, megacolon- where patients aren't going to the bathroom for >5days) surgery is an option. Often entails removal of the colon and sewing the small bowel to the rectum. Done laparoscopically. Tremendous improvemnt in quaility of life when properly selected.
Yes-sometimes needed. In very limited circumstances, constipation can become severe, and then it might be appropriate to consider subtotal colectomy to remove a non-functional colon as it may become a threat to life in very rare circumstances--again, not common, and a very drastic change, but sometimes necessary!