- First of all, you can get criticised. You may learn something from it, so you can improve. It's dangerous.
- Code shows your skills. They improve over time. Future employer can see you grow. That can end up with too big salaries.
- By resolving your problem you can become contributor of huge project. Like posting pull request to some framework. Then recruiter would think, you are a super star... you don't want that.
- Your code won't be hidden, ever... Imagine you do something cool, even for yourself. Great new business idea. And then you create snippet that is cool to. Only think is that this snippet has own value even outside the project. On the other hand it isn't something that affect value of the project. Say you build website for estate agencies and you have built nice CSS effect making buttons blink like Kardashians. If you don't publish that snippet as open source it will be forever safe. If you sale your project no one will use that snippet except new owners. If you publish it, you will keep all rights and it will be used by others... what a lose.
- Your code won't produce any direct money. No. Worse. You can build business model on top of it that you may not like. Like Symfony or MEAN.io. Making money on service, training and support. Do you don't want that mess and scaling business. You just want to code for food...
In the end...
Of course you should. It's fun. It has a lot of benefits. It grows you and your potential and allow you to learn with others. It's very important to use it not only as developer but also as company. Such like AirBnb share whatever is good (but isn't core product). Many business people won't understand it... let them read it. If they have sense of sarcasm, maybe they would get it at some point ;)