MDL-42323 - Deprecated function get_categories has no replacement

* Adding handling of recursive option in coursecat->get_children and added unit test.