People terminate business and personal relationships for all kinds of reasons. They discriminate for or against people.
Legislation preventing unfair dismissal punishes those who terminate some kinds of relationships for some kinds of reasons. An employer is punished for terminating their relationship with an employee on the basis of gender, sexuality, race or religion. Unfair dismissal legislation is ostensibly to increase employment, in fact it does just the opposite. A brief thought experiment demonstrates this.
Suppose you build a freeway system, and it is very popular. You decide to charge people $5 for the use of it, and set up toll-booths on the entry ramps. But you find that the $5 provides a disincentive for its use - less people now use the freeway - some of them prefer to fight their way through the crowded city streets instead of paying the $5.
Someone has an idea - instead of charging $5 to get on to the freeway you charge $5 to get off the freeway, and set up the booths at the exit ramps.
Does it make a difference? Of course not. Consumers are not stupid. They know if they drive onto an entry ramp they will get charged the $5 (eventually), and their behavior will not change. Some people will simply choose a non-freeway-use lifestyle.
Not consider employing someone. Clearly some employees will be unsuitable - either through their own dishonesty or tardiness, or though a misunderstanding about expectations or abilities. Unfair dismissal legislation can be used by disgruntled ex-employees to cause considerable damage to an employer. Particularly if they are from a 'disadvantaged' minority group. Suppose you created a system where every time an employer employed a person from a 'disadvantaged' minority group, there was a 1% chance of having to pay $50,000. Would this deter them from employing such people? Of course. They would (quietly) choose not to employ people from that group. It would hurt the people from that minority group. Suppose instead the 1% chance occurred on their termination? Would it make any difference? Of course not! Employers will still (quietly) choose not to employ people from any 'disadvantaged' group. Unfair dismissal legislation, like many forms of intervention, hurts the very people it is ostensibly designed to protect.