Those feelings came out of your self identification. On somebody's rejection you assumed yourself being a failure and tried to punish yourself by PMOing, but your accumulated knowledge and experience kicked in and stopped you. Honestly if you done the best you could, prepared well it's not up to you to decide on the outcome of the future events-It's up to God's will. Our Muslim brothers have a good saying when it comes to speaking about future events-they finish their sentences with- 'Inshallah' which means I will do my best to carry out my plan and fulfill my promise if God is willing for it to happen. Never feel failure or be despaired if you failed in something if you have done everything what was up to you.