Playing over or through ( there is a difference) Altered Dominant or Dominant chords can sometimes become reflex action to trigger 135b7/? thinking. Just my opinion, but that explanation is “cookbook” theory; that is, it tells you what to do, but doesn’t really explain why you might get good results doing it. So here’s a bit more of why that formula…”when playing over an altered dominant chord play melodic minor a half step up” works. But if you look at the chord tones of A in Bb melodic minor, it really makes a lot of sense.
The melodic minor scale is just a major scale with a flat third. (Technically this version is called the jazz melodic minor scale because in Baroque and classical music the melodic minor scale is only played ascending. For instance in A minor, play this sequence of notes B C# D# E D C B A.) So if we spell the Bb melodic minor scale we have Bb C Db Eb F G A Bb. Lets start this sequence from A, not Bb; what we will be doing then is looking at a mode of Bb melodic minor. we get, writing enharmonics in parentheses, A Bb C Db(C#) Eb F(E#) G A, or written as chord tones, R b9 #9 3 b5 #5 b7 R. So while this scale, played as a scale, sounds rather unpleasant, it contains pretty much all the alterations of a dominant 7 chord as well as the all import and tritone interval from C# to G. thus it a fantastic place to look for the chord tones in an altered dominant chord.
You will see this scale called the Altered scale, or sometimes the Super Locrian Scale.
Now the cool thing about the melodic minor scale is that another of its modes sounds good over dominant chords as well, in particular over dominants with a #11. If we spell the E melodic minor scale we have E F# G A B C# D# E, and by starting on its fourth note we get A B C# D# E F# G A. Listing these as chord tones we have R 2 3 #4(#11) 5 6 b7. This scale is called the Lydian Dominant scale, the Lydian b7 scale, or sometimes the Overtone or Overtone dominant scale. So sometimes you will hear another “cookbook” rule : over a dominant chord play melodic minor a fifth up. This is why.