The auto-loaded observer will take care of that; no need to provide additional edits to the usps.php shipping module. You'll change the observer's checking clause to read
Code:
            case 'NOTIFY_USPS_UPDATE_OR_DISALLOW_TYPE':
                // -----
                // Disallow "Media Mail" unless all products in the cart have a master_categories_id of '45'.
                //
                if (stripos($p1, 'Media Mail') !== false) {
                    if ($_SESSION['cart']->in_cart_check('master_categories_id', '45') !== $_SESSION['cart']->count_contents()) {
                         $p2 = false;
                    }
                }
                break;