The problem isn't really coming up with such a code, it's sloughing off all the crap that religions have glomed onto a simple moral core.
If religions are man made though, why is what they have to say not reflective of certain aspects of human nature?
Freedom is the right to be as dumb as you want, on your own dime. It's that caveat to which so many people and religions and governments object.
You are looking at it from the perspective that contemporary western morality reflects intrinsic human morality. Your argument rests on the individual as the supreme unit of morality, this is a statistical anomaly. Over human history, a collectivist morality has been more common than an individualistic morality.
The rights of the individual or the rights of the group, which take primacy? It depends on the culture, which is what there can be no universal morality as choosing one over the other changes things significantly.
The only thing that should be imposed/legislated is objective morality, meaning acts that are universally wrong, like murder, slavery and theft--one person violating the rights of another.
Well murder is a gray area, what is murder? Targetted drone strikes? Stand your ground? Death penalty? Vigilante justice?
In what way is opposition to slavery objective morality? Seems far more likely that the desire to dominate is 'objectively' part of the human condition. Also, is forced prison labour slavery? National service?
What about theft to feed a starving child? Wrong? Theft of intellectual property? Unlicensed drug manufacture in poor countries?
All else is subjective virtues. You can't point to those and say, because of them, there is no objective morality. You put them in their place.
There is subjectivity in all virtue. In the past, taking enemy slaves was a virtue worthy of great honour. Murdering a tyrant still might be.
We can say that there are certain things that all people would be against happening to themselves, but we have no evidence that the golden rule is something that all people would agree to.
The Truth is always enlightening, but it's also, very often, painful.
I imagine that the ideal society that you and I want to live in is pretty similar.
The problem is human nature does not seem to reflect this society. That doesn't mean that there cannot be 'good' people and 'good' societies, its just that these reflect a time and a place, rather than an evolution or a trend. History is cyclical we advance and regress.
"The Lord giveth and He taketh away". Here today, gone tomorrow.