When I draw the gradient, it is inserted as a new layer in the stack.
If I try to drag the gradient onto a layer I want to mask, it is not possible to drop it on the layer ; only in between the existing layers.
There is a work-around.
If I create an empty mask for the layer I want, then I can drag my gradient to become a mask.
The empty mask can then be deleted.
The same happens with the "Mesh gradient".
And I suspect with any vector layer.
Why not allowing vectors as mask by drag and drop ?
Hope my explanation is understandable ...

Best regards
Phil