Fix issue 3761.

_split_mul tries to write an integrand as c*x**a*f, where a and c are
independent of x. However, it did not actually test that a is independent
of x ...

Fix this, and add the test from the issue.