...soloing over an A major chord using a B major scale "works"...
Define "works." Anything can "work."
A major and B major scale only differ by two sharps, D
and A
sharp.
Common tones are B C# E F# G#
- which superficially looks like an E
major pentatonic scale. That set of tones over both an A
major or B
major chord give flavorings of maj7
, add6
, and add9
.
...but there is no A in B major...
Right. The A
is A#
.
By typical chord/scale matching a B
major scale to a A
major chord does not really work.
A lot of things "working" can be explained in terms of modal flavoring or altered tones. For example, a lowered seventh scale degree can give a mixolydian modal flavor, or raising/lowering the ninth or fifth of a dominant ninth chord makes it altered. There is also something called a chromatic cross relationship, but that is usually seen with the leading tone or third of a scale. In the case of an A
major chord with a B
major scale, the root or the chord is "altered" by the scale. It doesn't really "work" by the conventional means of introducing chromatic tones.
This is where describing something as "works" is too vague. At least too vague to call music theory. To the extent that A#
doesn't "work" you might be better off playing E
major to get an A
natural. The only differing tone will be the D#
which will give a lydian flavor to the A
major chord.
If the A#
is handled carefully, you can mitigate the dissonance. Play it less, shorter durations, in metrically weak positions, and it will lessen the mismatch.
If "works" means polytonality, then it's a completely different ball game. You then embrace the clash of hearing A
major and B
major simultaneously and sound like a modern, someone like Darius Milhaud, or Stravinsky.