In my personal opinion, you WANT to recognize shapes and patterns in the playing because let’s be honest, the modes overlap each other. If you look at them on on a fretboard photo with the notes marked, you can see how they ‘bleed’ into each other. Recognizing this pattern helps tremendously with transitions. Also, Randy Rhoads was huge on finding patterns and not just “theory”. Make sure you let them intertwine though, because that’s ultimately how you truly learn the neck and the scales and stuff like that.
As far as practicing lead and rhythm and theory and finding the right time to balance (I think that’s what you were saying) Is to apply your theory as you play. Be consciously aware of what you’re doing. If you play a lead lick, find the notes and say to yourself what key you think it’s in. If you modulate or transition, just work out the bugs. However, sometimes you may shoot yourself in the food because you’ll end up with so many accidentals there won’t BE a key signature, and that’s ok too!
To combine the practice of lead and rhythm together: Pick a song you like and play the whole thing through. Rhythm AND the solo. You just have to practice both at the same time and not intermittently because endurance and stamina for lead and rhythm are two different things. And if you just practice one or the other for any length of time, one will lack and your stamina and ability to transition will suffer.