That’s all counterparty risk. If you deliver the payment before the service/good the buyer takes on the risk. The opposite is true if the payment or good is delivered first.
You can dial the risk in either direction with any payment scheme (20% down balance due on delivery etc) but you can’t eliminate it.
Right yep, I understand what you mean. Yes, ultimately you need some kind of dispute mechanism that probably requires actual human intervention.
A good example is how disputes work on P2P crypto exchanges like bisq - you have a crypto contract of some kind that holds funds in escrow, but ultimately disputes are resolved by a team of actual humans who look at the facts and make a decision, not everything can be "code is law"