You don't need a hosting provider. Your code fits on each developers' machine. (Remember when git was touted as a distributed version control system?) If it doesn't, you're at the scale where you're not worrying about your hosting provider dropping you — they're worried about you dropping them.
That's just as true of GitHub though, and isn't the problem. The problem is the related services, like issues, PRs and now CI/CD which all sit with the code but don't come down on a clone. That problem still hasn't been solved, which could mean your whole knowledge base goes missing if you lose access to the server. CI/CD can maybe be replicated from what's on your laptop, but if you don't have the PR history it could spell doom for big codebases that don't use extended commit messages a lot.
I never understood why all that stuff wasn't also committed to the same repository. History is history, whether it's source code or talk about source code.
Of course it could also be in a database thingy for querying and stuff.
Some people say it is because Github wants to lock you in. I don't really believe that, but I am equally sure they don't mind if you lock yourself in.