The point of the monasteries, and of religious life in general at this time, was personal perfection. That sounds a bit selfish by modern standards, but really, it is the primary point of life. If you would be perfect... said the Lord, and people have been caught by the challenge since the beginning.
We all admire those who give it everything: the Olympic athletes, the founders of amazing businesses, the actors and actresses who perfect their art. The monks and the nuns took the challenge of holiness and ran with it. They said, "To be the best of the best is to be wholly given to God; we'll do it."
And they did.
Deny yourself? They did penance. Leave everything? They lived in deserts or walled houses away from everything. No personal property. No earthly loves. Give it all you've got...to God.
Now the fallout from really living for God is loving your neighbor. It's the fruit of a genuinely holy life - and so these monasteries became schools and refuges for the poor and hospices for the sick...
Funny, you give everything to God and become the most perfect you can - and all the world benefits. Not so selfish after all.