When it comes to soloing anything is "available" at any time. It just depends if it sounds good to you. The more notes that are diatonic to the key the more consonant or "inside" it will sound while more non-diatonic notes will make it sound more dissonant or "outside". As you're probably aware, this tension and release between dissonance and consonance is one of the key aspects of harmony.
What may be less obvious in your example is that a common trick in ii-V-I's is to go outside or purposefully introduce that tension on the V chord. So D Dorian over the Dm7 is diatonic and sets up the consonant sound of the key. Then over the G7 you have your options open to go a bit wild. You specifically want to create dissonance that can later be resolved so try focusing on creating something interesting rather than staying diatonic. Then on the I chord you bring it back home with resolution via consonance (by the way by the #11 I wonder if you mean Lydian which is common to avoid the natural F that sounds bad over a CMaj7).
That's just one way. You could introduce the tension over a different chord, never do it, or make it all dissonant and never resolve it. But what I described is one of the more common approaches.
If you search for something like "soloing over dominant chords" you'll find a lot of scales and modes to try out for that dissonance. But what those all come back to are highlighting extensions or alterations of the G7 in various ways. The less chord tones and/or the crazier the alterations the more outside it will sound. So part of choosing your mode/scale is deciding how far out you want to go.
(Obviously this only applies to solos. You'd stick closer to the diatonic scale and arpeggios when comping for somebody else. Otherwise you'd be stepping on their harmonic choices and creating chaos.)
EDIT: long response to comment
I have one quick question. Why is it all in D? Wouldn't you move to, let's say, G Locrian instead of D Locrian over the V7 chord? That V7 chord is a G after all. Is it preference? Would D Dorian-G Locrian-C Major be suitable?
D Dorian is essentially C Major and the reason that you use it over Dm7 is that Dm7 is the diatonic ii chord in C Major. Over the G7 you could move to G Mixolydian which again comes from C Major. So you're calling it something else but you're basically staying diatonic and thus producing an "inside" sound. If you wanted to play "outside" over the G7 you might pick a different mode/scale.
You'd have to ask said bassist why he chose to reference D modes over a G7. But you can just switch over to G—I personally prefer that—and change the name of the mode along with it. D Locrian is the same as G Phrygian and D Phrygian is the same G Aeolian.
As for why they work or not, I'd refer you back to what I said about it all coming down to chord tones, extensions, and alterations of those tones. You have a harmonic context that you're playing against. That is, the band is playing a chord and no matter what you play you could look at as either you're playing a note that's in that chord or you're not. If you play a chord tone it will sound inside/consonant and if you don't it will sound varying degrees of outside/dissonant depending on which note you play.
Now think of a scale or a mode as a shortcut to tap into that harmonic context without having to think about each note and how it relates to the harmony (not that that's a bad thing, but it's hard to do at first). You're picking a group of notes that are some degree of either inside or outside in a way that you're familiar with. As for how to get familiar with that I'd recommend two things:
- Play them against chords to hear them
- Write them out paying attention to which chord tones a particular scale gets you.
For example, with that G7 in mind as the context, let's write out the chord tones and the extensions:
G B D F A C E
1 3 5 b7 9 11 13
Now we'll consider G Mixolydian as the prototypical example of "inside" because it has only the chord tones and unaltered extensions. Everything is just diatonic from the V7 chord and it's extensions.
G Mixolydian (C Major)
G A B C D E F
1 9 3 11 5 13 b7
And I guess it's arguable as to what could be considered the prototypical "outside" scale, but we'll use G Altered Dominant (aka G Super Locrian, the 7th mode of melodic/jazz minor). The point of the altered scale is that it has all of the altered extension notes: b9, #9, 3rd (b11 but you wouldn't actually call it that because it's already a chord tone as the 3rd), #11, b13, b7 (#13, same you wouldn't actually call it this).
G Altered (Ab Melodic Minor)
G Ab A# B C# Eb F
1 b9 #9 3 #11 b13 b7
Now let's write out your D Locrian and D Phrygian as G Phrygian and G Aeolian, respectively:
G Phrygian (aka D Locrian, aka Eb Major)
G Ab Bb C D Eb F
1 b9 b3 4 5 b13 b7
G Aeolian (aka D Phrygian, aka Bb Major)
G A Bb C D Eb F
1 9 b3 4 5 b13 b7
In both, one thing to note is that they both contain a G Minor Pentatonic scale and some extensions/alterations. The minor pentatonic is a common scale over dominant chords in blues and rock as you may be aware—it's typically the first thing people try soloing with—and the extensions give it some extra outside flavor.
G Minor Penatonic
G Bb C D F
1 b3 4 5 b7
So as far as inside/outside your examples are going to fit somewhere in the middle between inside and outside leaning a bit more outside but in a familiar way given that they contain the G Minor Pentatonic.
Any time you're unsure if or why a scale/mode works, just write it out and see what chord tones it's getting you. And of course listen to it to see if you even like the sound.
I know many things are available but I'm afraid of taking that concept too far
You'll have to use your ears for that part. There's not much theory to help with it because it's a matter of taste. If it sounds too boring to you, go a bit further outside. If it sounds too dissonant, go back inside a bit. Also pay attention to where you play what notes. Playing outside tends to work better if you use inside notes on strong beats and to resolve to.