When I coach kids, I need short phrases - "point left, turn left", "keep your chain on the curb", "look at every car". My phrase for this one is "keep your pedals turning".
You are halfway there already. You know what you are doing. You know it isn't right. You know what is right. You know why the right way is better. My suggestion is to start by keeping your pedals turning. Even if you are tired and coasting, force yourself to keep the pedals moving. Once you have that, you will learn to choose gear ratios that optimize what your feet are doing.
I remember when I started commuting to work. There was a time when I got to work and home with one stop each way (coffee, bathroom, etc.). Then I got to only stopping on the way home. Then I got to keeping my pedals turning the whole way home. This was a struggle because getting home doesn't necessarily have a "start" time like getting to work does. After that, it was just a matter of building speed over time and watching how I very gradually started to choose higher and higher gearing.
Bikes work fine with coasting, so this isn't a safety issue or anything. Just personal fitness and efficiency. Keep at it, but don't go crazy. Even very experienced riders will coast in various situations, such as certain turns and downgrades.