The animdata_filter_mask() was not respecting the filter flag of
ANIMFILTER_FCURVESONLY which lead to cases when animation system
element is effectively cast from MaskLayer* to FCurve*.
The proposed solution more closely follows the GreasePencil filtering
makes it so when ANIMFILTER_FCURVESONLY flag is uses no mask layer
channels will be added.
The basic dopesheet seems to work the same as before, but this is one
of the areas where it is hard to predict all consequences so extra
testing will be welcome.
There is also a decision to be made whether we want it in 3.4 or,
since this is not a recently introduced bug, play it safe and only
include the fix to 3.5.