but laws are based on morality.
hehehe, yea ok. the most prominent examples are hemp being outlawed for forestry interests, and alcohol prohibition as a manoevre against immigrants, but if you look into the laws we have in general you'll find that there are plenty enough which aren't based in moral concerns to sufficiently debunk the notion that morality is why law exists, rather than merely that many laws satisfy the popular morality of the culture (here it's being cautious about the argument fallacy of confusing correlation with causation)
let's start though with the morality on which is based the law against riding a bicycle without a helmet. We can get to things like the right to wear no clothes at sandy ocean-side locations (the immorality of being the way god/nature made us) afterwards, if your premise applies sufficiently in the first place.
I would suggest others look up "golden rule".
I can assure you that most people here are familiar with the golden rule, as well as its earlier variation ('do
not do unto others as you'd not have them do unto you'), as well as the basic moral theories of Hobbes/Hume/Kant/Locke/etc. (those most relevant to this discussion)
perhaps not yourself but others and see how wide spred it was in many cultures and beliefs that had little connection with each other aside from early migration.
again I urge you to look for something more substantive than 'popularity' to back up the validity of a practice, as there is surely something you deny which is popular -- the morality of circumcising infants, the morality of sacrificing animals to the gods, belief in a cosmic creator... cultural trends, Occam's razor would suggest, demonstrate little more than what is good for a culture, and what is good for many cultures may reflect what is good for the survival of the species, but this itself, our survival as a species, is not necessarily a good thing, nor necessarily something we should aspire to contribute to, and so we can't use such things as arguments to preserve morality on its necessity. and of course it's necessity or utility, like that of Santa, to keep children in line, says nothing of its reality. We can 'grant for sake of argument' the popularity you're speaking of, merely to ask 'why are we to think this correlation is something other than advantageous behavior'. Consider, in this light, (may need to read this sentence twice, it's not the most coherent, I admit) yourself as a vegan: you will say 'more and more today---as we get more intelligent and sophisticated--veganism is growing in popularity, and its morality being supported as right', but you not being a vegan might recognise 'emo kids with a cause to make themselves feel special and useful and unique is indeed popular, but so what?'. You might argue 'eating animals is a popular practice, and always has been, it's as foundational in culture as the golden rule', but your vegan self would say 'does that mean we can't improve; that change must be regression to something worse?'
If you're able to allow for the possibility veganism is a broadening of morality, being moral in a wider and wider context, then you also have to be open to the idea that other contradictions to cultural standards popular throughout history may be right, even if they're a shrinking of the moral context.