Custom post types & Pages hierarchy - Error 404
'Flush' the permalinks.
a 404 when one has added code that creates or affects custom post types often is solved by simply 'flushing' the permalinks. One can do this manually by visiting settings -> permalinks.
https://typerocket.com/flushing-permalinks-in-wordpress/.
It's an 'expensive' operation, so it is suggested not to include the code to do it https://codex.wordpress.org/Function_Reference/flush_rewrite_rules, but just do it once manually.