Anything that is a "habit", that is not under your control, is bad. What you have done is program yourself to require extemporaneous movements in order to play. If you are just playing for fun I'd say so what, but if you want to play professionally or get better then this needs to be erased from your programming asap. I'm guessing you are self taught because an experienced guitar instructor would not have let this happen.
Keeping time is something that happens in the head while you play but it takes years to develop a good reliable sense of time. One reason beginning players lose time is because their mind is on so many other things, like getting the fingers in the right place, etc. You won't really be able to keep time silently until the other aspects of musicianship are so well developed that you can play with your eyes closed, which by the way is how you should start as a beginner. A good teacher will not let you look at your hands as that is another bad habit and a distraction.
We keep time by tapping our foot and in the guitar curriculum there is a very specific way that beginners are taught to correlate arm and foot movements in time. Using a metronome while practicing will help develop a good sense of time as well. Again, after many years of training musicians can keep time in their heads without body movement but the movement is a form of communication with other musicians.
By tapping the strings when there are rests you are effectively NOT RESTING. You are making noise of some type that is not part of the song and if there is a real break you will ruin it for the band and the audience. Imagine the song Unchained by Van Halen where DLR says "One break coming up!" and instead of everyone stopping you heard a dirty click, click, click. The song would be trash. Even if it's quiet and you think you can get away with it you are not in control of your own body movements and if you want to become a better guitarist, learn to play more complex music, etc., you are wasting valuable time tapping that could be used to set yourself up for he next lick. That will cost you dearly in the end. It will lead to sloppy uncontrolled movements and a dependence one the extra movement.
Based on the above the answers to your questions are:
"Is there any harmful things that this habit will lead to?"
Yes, see above, poor control, sloppy playing, and unwanted noise.
"What do professional guitarists do when there comes rest beats?"