Is there a code of ethics for Ph.D. supervisors?
There is nothing commonly accepted. And you are right that nobody receives formal training in how to supervise a Ph.D. Academia is really still very much in a medieval mode here, where you learn from your master (your own supervisor), potentially work under other masters (changing labs) and then are deemed worthy to have apprentices of your own, who you will treat roughly as your master treated you.

However, if you Google for "Betreuungsvertrag Promotion" or "Doktoranden-Betreuungsvertrag", you will find quite a few templates for formal agreements the supervisor needs to sign in some German universities. The key word being "needs to" - this is compulsory for the supervisors.

Unfortunately, these agreements only cover things like regular meetings between the candidate and the supervisor, and that the supervisor will give good advice and in general ensure that the Ph.D. can be attained within n years. This is all very nice, and any decent human being should already be doing all that is in there, but it's all rather vague. In addition, I seriously doubt that anything like this would be taken seriously in a potential lawsuit.

Bottom line: the good supervisors already do everything that's in these agreements, and the bad ones won't start once they have signed this.