Yes. It's unethical for a doctor to medically treat their own family, hence the practice of professional courtesy, a widely accepted practice among doctors to treat other doctors and their families for free.
To be clear, a doctor can lose their license by treating themselves or family members. There are exceptions, like in emergencies and for very minor issues, but even in those situations, doctors risk losing their license by treating themselves or family members because gaining an exception after-the-fact is contingent on others seeing it the same way, particularly their state's medical review board. That's why, generally speaking, doctors err on the side of caution and have relationships with other doctors to this end, relationships wherein one doctor has full access (i.e., 24-hour, including the ability to call that other doctor at home) to another doctor for treatment of themselves and their family and then that other doctor gets the same thing in return.
So, if my kid has trouble sleeping, I don't just scrawl out a prescription for Xanax, which would certainly land me before a medical review board. Rather, I call another doctor I know and tell him my kid has trouble sleeping and let that doctor decide a course of treatment, which I as a parent then have the right to accept or decline.