[eluser]Zorancho[/eluser]
Yes, you need the database queries cause you must match the url since each is unique.
Good thing about this approach is that you can cache the pairs of keys => values:
[some-category/some-subcategory] => category_controller/subcategory_action
You will need only one controller like this and it's kinda like white list approach to urls.
Your solution is okay i think, also when you want to override some of the core classes, just create MY_Router.php file in your (application/libraries in CI < 2.0) (application/core in CI 2.0 if you are overriding core class) and extend the CI class.
Code:
class MY_Router extends CI_Router{
...
}
copy any of the methods that you want to override and insert your logic.
To understand the flow of every request in CI have a look at the system/codeigniter/CoddeIgniter.php file.