The specifics obviously depend on the particular jurisdiction under which that is judged.
But from practical considerations the answer should actually be: "Yes".
I usually hate "arguments from human nature", but this might be one of the rare cases where even "general animal nature" would make us expect that a wounded animal, in fear of their life and physical well being is to be expected to fight back, when attacked. That doesn't mean that they will, but you have really no argument to act surprised if they do.
So to criminalize behavior that is unavoidable for the "culprit" is something that any justice system should seek to avoid, as that would mean that crime and punishment are no longer a question of normative ethics, resting upon the assumption that the culprit knows or could be reasonably expected to know what is allowed/forbidden and deliberately violated those rules anyway (while being fully conscious of that and the availability of alternatives). So usually the "guilt" of the person performing the crime and not just an undesirable action are required. Like the idea of "that was wrong and you should have acted different only works if they could have", "ought implies can".
So as a result if everyone could be a criminal just by being at the wrong place at the wrong time without any initiative of their own, then punishment can easily feel arbitrary, tyrannical, discriminatory and trust in a justice system can thus be eroded.
The other thing is that the state reserves for itself the monopoly of violence. So no one is to be legally allowed to use violence against another person. Be it aggressive, for law enforcement or punitive unless it's immediately necessary to avert a threat to oneself or others and even then only to the amount that is actually required to do so and not more.
Only the state has the legal right to do law enforcement and take out punitive measures and only after a fair trial. Regular citizens at best are allowed to assist in that with fairly limited permissions.
So usually there's a "citizens arrest" or even an "any person arrest" where people are allowed to arrest a criminal on the spot, though it might vary on the jurisdiction what this actually entails. So the criminal usually makes it worse by "resisting an arrest" even by a non-officer, however that doesn't necessarily mean that the civilian arresting someone has too many rights to engage beyond telling them they are under arrest and defend themselves (as they could always do) if they are attacked.
Also for example in Germany you can only hold someone captive if there is a risk of escaping or if they can't be identified. So you might even have to let go a petty thief who verifies their personal details, as the police has enough information to catch them. So idk a petty thief with a fixed address is unlikely to make a run leaving behind assets more valuable than whatever they had stolen in the first place.
So there's usually an evaluation between the necessity for self-defense, the necessity to stop an criminal on the run and the rights of that accused citizen, because without a trial there is a presumption of innocence and keeping another person captive against their will is a grave violation of their personal rights, that is only warranted under special legal conditions and potentially restricted to professional law enforcement and if it's persistent only allowed after a judge approved of it or after they've legally been convicted of a crime.
Another point to consider is that with regards to the crime, usually crimes against another person's life, liberty and physical well being trump property crimes. The latter being a lot easier to restore, replace and settle than the former. So not only did the mob likely exceed their permissions granted via citizen arrest laws, they likely engaged in extrajudicial punitive measures and thus committed a crime themselves that exceeds the initial crime.
So by doing so they might have entered a new situation where the thievery is almost a negligible factor.
So by the state claiming the monopoly of violence AND only using it when pushed to, the criminal can reasonably expect that if they surrender they remain unharmed and have their case heard in a fair trial before they receive punishment. So under ideal circumstances he's not attacked in the first place and thus has not reason to defend himself. And if he does, he's dealing with professionals who likely have better equipment, martial arts training, numerical power and whatnot, so that he's further disincentivized to go down that path.
While with mob violence, you erode the monopoly of violence, you likely create questionable legal priorities (enraged people usually have a hard time judging proportionality so "potentially fatal battery assault" > "thievery") and the thief themselves has no reason not to resist because they have probably good reason to expect harm and no idea what's going to happen next. Unlike with regular law enforcement where you should technically be able to explicitly read up the paragraphs of what they are allowed to do in what situation and that you shouldn't have to expect unproportional harm from them as they have no punitive permission to use force, but purely self-defense measures, but likely better capabilities to do so.