Slug of a child page is accessible with and without the parent slug in the URL
wordpress handle this using rewrite rules. in fact worpdress does redirect /bar to /foo/bar by default but it’s need rewrite rules to be configured correctly. maybe some plugin or custom rules is interrupting the default rewrite rules. try click on Save Changes in Settings > Permalink and see if auto redirect is fixed or not.