We should sell when we are at a profit. But not all who do not sell are greedy, I think they have trust in the developer and are very positive that the market will continuously uptrend. In your case, if you set your selling price and it has not been met, I do not think that it is greed when you end up bag holding worthless crypto because of a rug pull. It is an unexpected event, and probably already a plan of the developer, from that no one can do anything.
A developer may have the notion to pull the plug but they are essentially cheating the investors.
No investor wants this to happen, but talking from the perspective of an investor, one would like to reduce the risk by exiting the asset at a high price before the developers have a chance to rugpull.
This type of mindset will actually lead to a very unhealthy market but it is the case with majority of altcoins - since I dont like this personally, I avoid investing in altcoins nowadays. But for saving the invested money, one would always think to pull out before they pull out.
Greed is not the only thing here, people are hopeful and have goodwill for the project and scammers take advantage of that.