The doctors may be writing themselves prescriptions in large quantities not to use on themselves (way too many), but to have on hand to give to patients that need it. They would have no other way to get the needed drugs.
If they wrote themselves a prescription for opioids so they could disperse how they wanted they would be in prison.