To get the behavior that you want, you can use a fancier tool like 'find'.
This does not appear to be a bug, in that grep is operating as documented. When
searching recursively, --exclude-dir=GLOB will "skip any subdirectory whose base
name matches GLOB. Ignore any redundant trailing slashes in GLOB." In your case,
GLOB contains a non-redundant trailing slash, and such a pattern cannot match
any base name.
- bug#27730: --exclude-dir does ignore subdirectory Jiří Kozlovský
- bug#27730: --exclude-dir does ignore subdirectory Paul Eggert
- bug#27730: --exclude-dir ignoring subdirectory Michael Thielker
- bug#27730: --exclude-dir ignoring subdirectory Paul Eggert