Raul - it has been done “from thin air”, most notably in the Old Testament.
But not really.
Generally, morality has a purpose. And so, ideally, its purpose should be that of its creator. Often it is. Best to think of morality’s conceptual genesis, and not its temporal evolution, to understand this point. We learn the basics, the very basics, from our parents (those who rear us). Basic do’s and don’ts that will save our lives and promote safety, health, the family property, and so on. We can’t have junior lying to us - he lacks judgement, and so lying might cause the loss of his life, a sibling’s, family property, all manner of bad stuff. You can see that lying is interwoven with stealing, health (remember some of the Commandments past the first ten) -and other moral issues.
The organisation of humans into groups that have as a purpose certain functions - childrearing, food acquisition, protection - families, tribes, clans, nations - you get it, I’m sure - this requires certain rules that allow the members to rely upon each other without direct supervision. This process can be, and certainly has been, perverted from its original course - notably by the religious castes of certain societies. This may not destroy a given moral system - it may remain functional, but it is likely to promote the gross misunderstanding that morality is somehow an absolute idea. Religious castes are often charged with the kind of social rules that cannot readily be enforced by laws - laws can have a moral element, and do - but it is a question of enforcement - guilt works pretty well.
Exigency, expediency, purpose, utility - every other human invention speaks to these. Morality is no different. Some rules work better than others. Trial and error plays the major part. The rules of footballl weren’t invented out of thin air - a rule against saying “I am a goody goody girl” upon scoring a goal has not been established. The need hasn’t really been felt, I’d guess. The rules, more or less, fit the activity, suit the purposes of rules for that game. We seem to manage. Yes - the rules are made up, but not from thin air. There is a lot between dogma and anarchy, between Truth and nihilism.
That last, I get tired of saying. Oh, well.
fausty