Scotland’s chief medical officer has told an inquiry that people asked to shield during the Covid-19 pandemic should have had more support to help reduce their “isolation and fear”.