I wouldn't call Twitter or any other unicorn a "mid-sized tech company".
I believe the larger a company is the more it makes sense to do stuff in-house. You need a certain amount of people to focus on your core competencies, but once you have that and still have more money than you can ever spend, it makes sense to spend it on doing stuff in-house, as that might lead to better quality and/or lower costs and removes the risk that an external supplier might not be there next month anymore.