Custom Block in custom 404 node
The page you configure for a 404 code in admin/config/system/site-information is not a redirect to the new path, it reuses the original request and keeps the path. You see this in the browser, where the url remains unchanged when the custom 404 page is invoked. So you can't use the path from the 404 page to control the visibility.

See this feature request: Allow blocks to be configured to show/hide on 403/404 pages. I doubt that there will be any progress soon, because there is no activity for some time and the patch no longer applies.

You could implement the block visibility in a custom condition plugin or if you are looking for a simple solution do this in preprocess on theme level.

Or what I would prefer use a custom controller instead of a block, create a route to this controller and put this in the site settings.