I also tested:
1 #!/bin/bash
2 shopt -s extdebug
3 main() {
4 trap 'echo $LINENO' ERR
5 $(exit 17)
6 }
7 main
The above also has the desired output of 5.
So, either form of command substitution gives the desired result, but
using a subshell as in:
(exit 17)
does not give the desired LINENO result.
