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. Differential Revision: https://developer.blender.org/D16498