Relationships matter. McDermott felt comfortable with Babich's knowledge of his system and thought he was the most qualified. Multiple teams sought out interviews with him. That wouldn't happen if he was not someone people in the league thought was up and coming coach.
Other people left the organization like D-line coach Eric Washington and Safety coach John Butler both of whom you assume interviewed for position but did not get the job. Washington had previous experience as defensive coordinator as well but they decided to go with Babich. Normally that is how it goes in most professional organizations and you look to promote from within first before looking outside. It would not have made any difference if McDermott hired someone from outside the org as anyone could still make claim that McDermott is looking to protect his job and find new scapegoat. McDermott calling plays last year squarely put target on his back and obviously Pegula thought he did a good job as he is still here. However, long term probably something that couldn't be sustained as the head coach has responsibilities outside the defense he is responsible for. End of the day any shortcomings or failures by people around him also fall on the head coach.