Masking node in node editor?

I was compositing a character in a blender a few days ago and I remember saying “this would be a lot easier in the 3d viewport” I thought that if I could make a movie clip into a plane, and then use a mask to make everything else transparent. I could do all sorts of things. It would definitely speed up the compositing workflow, but The only problem is that I can’t transfer the mask (that isolates the person) into the shader editor for my plane.

I know one way would be to render out the mask and then put it back it, but that could take a very long time, especially if someone had multiple masks. Which brings me to my question.

Is there a way to make a mask node (similar to the one in the compositor) that can be used in the shader editor? And if there isn’t, how would one go around making one?