Decisive role of electron-phonon coupling for phonon and electron instabilities in transition metal dichalcogenides