The past perfect is used when we want to establish the temporal relationship between two events, both of which happened in the past.
So the past perfect is not apt here. There is only one event in the past in your example sentence.
The simple past is used with an event that happened in the past, and the present perfect is used with an event that happened in the past in terms of its implications for the present.
Therefore, the present perfect is the best choice here because it makes explicit the relationship of the doctor's past orders to your not eating cake now.
The simple past leaves that relationship implicit. It is a good choice here, especially since there are other elements in the sentence which make that relationship explicit: "as", which means "because", and "but", which also establishes a logical relationship.