Is there a way of applying the “Posts Edit Access” feature “”with category/taxonomy ID”” restriction to media files just like it works for pages?

No, it will not work as you wish.
Code is built such way, that 1st it defines what posts/pages/CPT are available for editing, only then it extracts the list of attachments for which those posts are parent. Attachments are not processed as an independent post type. So general scheme will not work for them.