Just sharing the result of some coding I did a while back...
For our moodle installation we do not use the out-of-the-box list-all-the-courses that is Moodle's default behavior. Instead, each top-level course category represents a tab, and any sub-category represents a "folder" inside the tab.
This is what it looks like for administrators. But for Teachers and Students, I only wanted it so that only the courses in the Teaching & Learning tab pictured above appear, but not the folders, so there is no "Arts" folder for a student, just whatever art class(es) they have.
To do this, I asked around and got some code, using these as references:
Attached is the renderers.php file, which should go in your moodle code directory /mod/theme/<name of your chosen theme>. You have to set rendererfactory in the config.php file at the same location as well. (This is explained in some of the links provided).
This is provided as-is, you'll need to adjust things to work for you. I'm happy to lend a helping hand. This was done with Moodle 2.3.
Also, this does not query the database, which means it runs fast and doesn't get in the way of the other queries that are happening. This is important because these tabs are available on every single page. I've found that having Moodle constantly querying the database for the user's course information is one of the best ways to slow it down for the end-user.
Particular thanks to Sam Hemelryk who provided just the right amount of hints.