Little Snitch can detect and block connections at the process level. https://www.obdev.at/products/littlesnitch/index.html
that works in a lot of cases, but unfortunately it seems sometimes you get these popups about nsurlsessiond (for example) where you know where the connection goes, but no idea where it comes from (especially if it's trying to connect to to some generic AWS hostname) And as much as you can use little snitch for programs you install, these days it seems an endless whack-a-mole to block Apple's stuff as there's so many…
Little Snitch might be able to tell which process triggered that, if you press the info button in the alert. I'll have to check next time it happens.