“A habit needs to be enjoyable for it to last.”
The fourth law of behavioral change is: make it satisfying. What is rewarded is repeated. What is punished is avoided.
The key is that only instant satisfaction matters here. Our brains work in such a way that some potential future benefits don’t give us much satisfaction in the moment. Eating healthy will benefit us in the future, but we will get more instant satisfaction if we eat tasty food now. Smoking is similar; it may kill us in the future, but the instant satisfaction is much stronger than thoughts of the future.
Usually, bad habits give us instant satisfaction, and the bad effects are someday in the future. Similarly, good habits don’t give us instant satisfaction and the positive impacts are delayed for months or years from now. What you can do is add a little bit of immediate pleasure.