Yes pumpkin pie should always be kept refrigerated if you do not plan to eat the pumpkin pie right after baking it or if you're not gonna eat the pumpkin pie for a day or so.
If you're gonna eat the pumpkin pie the same day you baked it or bought the pumpkin pie then it's usually safe to leave it out for the day.
But if not then you need to refrigerate it since the pumpkin pie contains eggs and milk which have high protein and moisture content and when the eggs and milk are left at room temperature the conditions become just right for bacteria to multiply on the pumpkin pie.
So when the bacteria is growing in or on the pumpkin pie it can go bad and not be safe to eat.
So always keep the pumpkin pie in the refrigerator if you do not plan to eat it within the same day.