Hello,
How about checking that you have the setting 'Show all courses'(navshowallcourses) in the site admin unticked?
Otherwise, if you are able to upgrade to a supported version of Moodle such as 3.8.6 or later, you can use the view course list capability to hide the list of courses that the user is not enrolled in.