Hi. I have limited experience with AE, but I believe the principle (as with Photoshop) involves layers. One of the original clip (for the background) and a duplicate layer of the original for the foreground, with your green screen in the middle.
You may need to green out the foreground clip where your insert is going to show. You may be able to create a path that follows the motion. I don’t know if any of this is a real help. Just thought I’d share my two cents. Good editing. ✌️