When building something to make you money, you're not working with a large group of other developers or "giving back" to any community.
As to giving back, there's nothing stopping you. My latest for-profit venture has spun off two open source projects that "the community" can use in the future. Past projects have done the same.
The key is to do things to benefit yourself, with open source being a side product. That's how big companies do it. Why shouldn't it be the same for us little guys?