I think a lot depends on what we call “a bad diet”. There are bad diets, very bad diets and various shades either way.
My own personal history serves to tell me that as my life has become more and more sedentary my weight has gone up and that includes the recent past where I don’t even leave the house to go to work. Last year at 102 kg I was the heaviest I had been all my life at a time when I also have been the most sedentary since being a baby.
Is that (entirely) down to insulin resistance?
From a personal perspective whenever I have tried to lose wait and succeeded I have found that the biggest factor in losing that weight has been exercise (activity).