Doctors can undergo special training in 'palliative care'. These docs have a pretty broad spectrum in terms of when they become involved, but from my own experience they've been pretty good at being patient/family advocates to primary care teams. They should ideally get involved at the beginning of any chronic illness, to discuss goals of care regularly, and provide patients and families with resources for end of life care (e.g. hospice, home hospice, etc).
This is not the best explanation, but hopefully it brings you and other readers awareness of this growing specialty.