Yeah, I like the idea and thought of something similar a while back
The downside is I couldn’t see any way for us to be rewarded without others incurring a penalty if they fail to do avoid doing their bad habit. I later developed a moral standing on the issue after coming up with this idea, in the same way interest is paid to users’ savings off the backs of penalties of users’ overdrafts.
Although your idea (back on topic)…
… would overcome this issue.
Not everyone can afford to have part of their balance locked away though so would need to a way of disabling it either permanently until choosing to reenable or in the event of a financial emergency. The argument to that though is that this very feature may prevent financial emergencies from occurring in the first place.