The decision is yours. Only your physician knows if the surgery and plan to insert a pin will reduce the enlarged joint. If he has determined the bunion was the cause of the hammer toe, then I would think removing it is the way to go.
Since wearing shoes that narrow toward the toe and have higher heels is a leading cause of hammer toe, you may be advised to forego wearing this type of shoe. Your physician is the best person to ask.
Before you make the final decision, ask all your questions. feel satisfied with the answers, and weight the pros against the cons of surgery.