I'm not sure I understand your specific scenario here, but it sounds like you may want to use the /2/sharing/get_folder_metadata endpoint. You could supply the team or shared folder ID as the shared_folder_id, which would give you the 'parent_shared_folder_id' value. You could then call again with that ID to get the information for that parent folder.
If that isn't what you're looking for, please share a sample so I can take a closer look for your use case, e.g., so I can see what particular event you're working from. Thanks!
That's correct, 'parent_shared_folder_id' isn't guaranteed to be set. It is only set if the item is inside a shared/team folder. Some or all of a user's files and folders may just be in their own private folder, and not shared with anyone, in which case 'parent_shared_folder_id' will not be set.