What an infuriating, miserable loss of a day this was.
I have a reproducible build failure that I can *only* explain if there is a bug in gradle.
Trying to make a minimal test case, I make a new Android Studio project and copy all apparently relevant bits from the gradle file. The bug doesn't reproduce in the new project.
I think I need to file a bug and move on, but I can't make a minimal test case, so they'll probably disregard my complex test case— and maybe they should! I dunno!