Place a compositing tag on your text object and in the tag properties object buffer tab, check the box next to buffer 1. Then, in render properties, enable multi-pass rendering and add an object buffer pass and a shadow pass. That should give you what you need.
You’ll use the object buffer pass as a luma matte to isolate your text, and then you’ll multiply the shadow pass over your other footage to add the text shadow.