Why do we have autarky price of mud pies equal to 0.5 of cheese, while it must be zero? (It's assumed that we work with the Ricardian model)
Absurdtopia is an autarky. Production of 1 mud pie requires 1 labor, while production of 1 cheese requires 2 labor. We know that price of 1 mud pie in terms of cheese under these conditions will equal to (labor needed to produce 1 mud pie)/(labor needed to produce 1 cheese)=1/2=0.5 cheese. Or in other word, 1 mud pie has price equal to the opportunity cost of its production, in this case 0.5 of wine. It's also called "Autarky price"

But there is one strange thing about this price. It completely ignores demand and utility of customers. Consequently, it is possible to imagine such result when this price will false. In our case it's obvious, nobody in their right mind would agree to give 0.5 of their hard-earned cheese for absolutely useless mud pie. Thus price of 1 mud pie in terms of cheese isn't 0.5, it's strict zero. It seems like our formula miserably failed to take into account utility function and demand of consumers, that it's inadequate.
In Ricardian model prices depend also on consumer utility and demand. Without that it would be impossible to solve the model no matter what the goods are. However, this is usually not explicitly mentioned in bachelor level textbooks where all models are for better or worse described in overly simplified form as not to load too much on most students. In fact you always have to make an assumption on demand in Ricardian model. Standard undergraduate model assumes that utility is identical for everyone home and abroad and such that the demand derived from utility function is homothetic across countries. Of course, you could also make some own 'unrealistic' assumption on utility and demand by assuming lets say country only wants one good or just some fixed quantity of the good etc. Under some assumptions it could be even impossible to actually solve for the price. However, if you for some didactic purposes want to assume there will always be 2 industries no matter what the demand is then price can be still determined even without any explicit demand. 

The reason why you can say that relative prices are equal to the ratio of productivity is that assuming perfect market, then the prices will have to be equal to the marginal cost of production which has to be in equilibrium equal to marginal product of the factor of production (in this case only factor is labor). As long as you impose restriction that both industries exist prices have to be such that they equal the ratio of productivity. If this would be violated then all workers would just go to the sector where they can get higher wage  for the same effort in terms of labor (here there is no economic profit all accounting profits are paid out as wages). For example, if productivity is such that 1 cheese = 1 labor and 1 mud pie = 2L then if the relative prices $\frac{p_{ch}}{p_m}$ are anything else than ratio of the productivity $1L/2L$ the other sector would completely collapse and could not exist anymore, violating the assumption both sectors exist.

But again all of above is extremely simplified version of Ricardian model. In actual Ricardian model you dont have just 2 goods but $n$ number of goods, you have wages utility and much more. Following PhD level textbook by Feenstra, the set up of Ricardian model includes:


Continuum of industries indexed by $z\in [0,1]$ with productivity in each industry being $a(z)$
The utility is given by $U = \int_0^1 \ln c(z) dz$, and since consumption has to be equal to the income this utility function is subject to the constraint $c(z)= wL \implies c(z)= p(z)z$, where $z$ would be some good consumed (remember these are all distributions, its not just 1 good but potentially infinite amount of goods since $z \in [0,1]$ and there are infinite numbers between 0 and 1). The demand is derived from utility function by solving the consumer optimization problem (that is how to spend resources in a way to maximize utility).
To clear markets in autarky prices are set $p(z) =wa(z)$ where $w$ is the wage.
Next you would assume the all above would also hold for foreign country and then let them trade (I might have also skipped some minor auxiliary assumptions - for full treetment see Feenstra (2015) chapter 3.).
Once countries open up to trade, balance of trade is assumed so: $\frac{w}{w^*} = \frac{z}{1-z}\left(\frac{L^*}{L}\right)$, where star * indexes the variables from the second country. Once the trade opens up the prices will be given not by national supply and demands but by world supply and demand which could be derived from the above assumptions.


Now, I wont post the full solution to this model but due to the budget constraint prices also depend on what the utility, and by extension what demand is (since demand is always derived from utility). Hence, in Ricardian model there is absolutely nothing strange about price determination - its a part of the whole system and each part makes quite a lot of sense if you think about it individually. 

To sum it up, the full treatment of Ricardian model does and not only that but also has to include both utility, demands, consumption, wages etc. So your description of Ricardian model in your question does not make it justice. In a proper Ricardian model the question does not make sense because the prices actually depend also on utility and demand - you cant really make models in economics without including utility somewhere in one way or another, explicitly or implicitly. However, dont expect to learn all this at once. The purpose of the simplified version of Ricardian model that does not include all of the above explicitly is to make it easy for students to follow, but as a result the simplified Ricardian model will have many 'plot holes' and if you just try to rigorously examine the simplified Ricardian model it will never hold up - it misses too many important parts but again thats just for didactic purposes - not because the 'full' Ricardian model does not cover these.

References: 
Feenstra, R. C. (2015). Advanced international trade: theory and evidence. Princeton university press.