Considering that they also use the replicator for important things where it has to be the same as the real deal -- including medicine which is just as complex as foodstuff -- that alone explains why it "needs" to be identical to whatever it's replicating.
Do they? Most things that are super important to the plot can't actually be replicated and have to be shipped or collected from somewhere first. Kivas Fajo's Hytritium supply being the most obvious example: for whatever reason a replicator cannot manufacture the substance or the crucial ingredients for it so they had to buy it from Fajo first.
i don't recall seeing replicators used to make medicines or exotic compounds (aside from Voyager, whose treatment of technology I am unable to take seriously). They seem to keep that stuff "in stock" too, and it's difficult enough to replicate that "freighter full of medical supplies" is an amazingly common plot device in TNG and DS9. Why are all these poor civilian ships indicating their ultimate innocent bystander status by hauling medical supplies if you can just REPLICATE medical supplies anywhere?
Considering it's basically a variant of a transporter, there's no reason at all that it couldn't perfectly replicate anything it had on file.
The fact that the "files" cannot be detailed enough to accurately reproduce most of the things they want. There's a storage problem here: at the amount of detail needed to reproduce, say, a fully functional shuttlecraft, the data storage device needed to store the shuttle's pattern would end up being larger than the shuttle itself; it simply makes more sense to store the shuttle as an object, rather than the data used to produce it. On the other hand, a far less detailed (and non-working) facsimile could be replicated a couple of dozen times using a storage device no larger than your fist. if you're also keeping pre-fabbed working parts on board, you could just replicate parts of the frame, engine housing, seats, carpet, and assemble all of them into the chassis along with the pre-fabbed parts that you can't replicate because they're too complicated.
That said, I'd argue that it's more of a psychological thing. If you did a blind taste test, or just fed people replicated food while pretending it's something you prepared yourself, no one would be able to tell.
I think it's the opposite: i think most people are so used to eating replicated food that the REAL THING actually tastes funny; the artificial flavoring of replicated products is ingenious and well studied and lacks the imperfections and variations of real foods. OTOH, people who grew up not relying on replicators (the Siskos, for example) usually prefer old-fashioned style cooked meals.
And there's another reason to think that the fidelity of the product is an illusion, in the very GOOD example of DS9's wonky replicators. When those things malfunctioned or broke down, they produced a cup of coffee that was bad to the point of being almost undrinkable; if the problem was the molecular structure of the product, that malfunctioning replicator would represent a potential health hazard to the crew and would be shut down immediately, but instead Sisko just quietly complains that it TASTES terrible while accepting that it is, undeniably, coffee.
A similar thing happens at Quark's bar, where about one half to two thirds of his products are imported and purchased and not replicated at all. We don't actually see a lot of money changing hands, but it stands to reason Quark probably isn't changing money for the replicated drinks that people can get anywhere. But if the replicated drinks were as good as the imported stuff, Quark wouldn't make any money at all, because nobody would order them. Indeed, the existence of replicator technology would negate the existence of the entire Ferengi Alliance if it really worked the way people assume it does.
So you could easily replicate Kanar or even that "dreadful" Bajoran Synthale, but people still prefer the real thing enough to actually pay money for it.
Similar to Guinan, who never openly charges anyone money, but still keeps a stock of drinks on hand.
Even the food synthesizers and protein resequencers from TOS and ENT produced real food...
They produce edible food that bears a close resemblance to what they're pretending to be. They definitely don't produce the "real" version of what they're resequencing (which is the whole reason NX-01 has a fully staffed kitchen).