Fixed #19939 -- generic relations + split_exclude regression

Added a test, the issue was already fixed (likely by the patch
for #19385).