The problem with self-hosting is one of managing the servers. When you are a small team the effort is just not worth it. Yes, there are risks when you give your code to someone else, but hopefully a company whose job is to host source repositories will take enough precautions.
Note, you can host GitHub within your company, but again - it is usually not worth it unless you are a larger company.