Avoid PHP notices in Media Library if an attachment parent post type no longer exists.

Synchronize the 'edit_post' capability check between the list table and the media grid.

fixes #27446.
Built from https://develop.svn.wordpress.org/trunk@29320


git-svn-id: http://core.svn.wordpress.org/trunk@29101 1a063a9b-81f0-0310-95a4-ce76da25c4cd