If both can express habits like things you tend to do, what is the difference between their uses?
Why was つい used here? Would 〜がち also make sense?
つい doesn't necessarily stand for habit but that you do something unintentionally. がち stands for tendency and means that something is expected to happen to some extent frequently, whether it's intentional or unintentional.