So, first let me say that I am not a doctor or a medical professional of any kind, so what I will say is from a coach's perspective not a medical perspective. I think we have all been in this position before. We are registered for a race that we have been looking forward to, and BAM we get hurt. It seems like you did the right thing by resting for a few weeks, which I assume means no running, but still keeping up with swimming and biking. Without knowing all the details, it seems like the plan derailed a bit when your first big run back was the half-marathon. That set you back a bit for sure, because racing is definitely not training!! Then, even though it was hurting, you still did "a few" recovery runs. Hmmm...You have to remember to listen to what your body is telling you even if it's not telling you what you want to hear!
My advice to you would be to do as your doctor says and not run until it feels better. Once it is feeling better, ease back into your mileage slowly, and if your foot hurts, STOP! In the meantime, you can do some deep water running, which is a great way to maintain run fitness when you are unable to be out on the roads. Also, use this time to have a little cycle/swim block as well.
As far as the upcoming races, especially the one that is around the corner, a very wise doctor once said to me: "Don't sacrifice your entire season for one race." Keep everything in perspective and remember that there are more races than the next one! Turn your race into an aquabike, or defer your entry until next year and volunteer instead! Keep up the pool running and the rest of your training, and when you get the green light from the doc to run, ease back in. Make the decision on the half-ironman once you are running pain-free, and you will be much happier in the long run (literally)! Good luck with the training and the healing!
If you have a question for me, please shoot me an email.