Interesting question! I'd like to repeat this oft-repeated quote about ideas in general:
Ideas aren't even worth dime a dozen, execution is all that matters.
Implementation of your idea isn't just about coding, a whole lot of other things matter too. Consider the idea of a Cab Booking App, for instance. Why do you think there are only a handful of successful apps like Uber, Ola, etc. even though there is so much scope and earning potential in this idea?
By your logic any freelancer who contributes to a Cab Booking Project can "steal" that idea and start a Cab business himself, isn't it? But enter the real world of implementation! Implementing that idea isn't that simple, you need to have all kinds of homework done to make that idea successful. In case of Cab booking business, for instance:
- Liaising with Cab unions, government agencies, etc. and getting required permissions.
- Social media marketing to find users who are ready to use your app.
- Performing necessary SEO to increase visibility of your app and website.
- Making all registrations and sign-ups on Play Store, Apple Store, Web Hosting, etc. and perform necessary arrangements for deployment.
- Preparing a team for integration-testing and Q/A (there are bound to be bugs in your freelancer's code!).
- Preparing a team for legal defense (there are bound to be repercussions from existing cab drivers in the region where you'll implement your app).
- Preparing a team of Chartered Accountants, Company Secretaries, etc. to manage your finances and administration.
Now, if a freelancer was able to do all the above on his own after taking the idea of a "Cab booking app", he wouldn't have been a freelancer in the first place and graduated to a CEO/CFO already!