The legal reasons for dismissal in the UK are described here: it includes such things as being unable to do your job, redundancy, violence on the job, being sent to prison, the factory burning down. It does not include quitting. "Unfair dismissal" is described here, and it says
Situations when your dismissal is likely to be unfair include if
you...resigned and gave the correct notice period
This page then describes recourse for unfair dismissal.
§108(1) of the Employment Rights Act says that
Section 94 does not apply to the dismissal of an employee unless he has been continuously employed for a period of not less than two years ending with the effective date of termination.
§94(1) then says that "An employee has the right not to be unfairly dismissed by his employer". §108(2) also lists numerous cases where the two-year tenure condition does not apply. Most of those reasons clearly don't apply to the act of giving notice (it includes e,g, pregnancy, whistle-blowing etc), which means that any firing because an employee is pregnant (etc.) is automatically unfair, regardless of duration of employment. §104 which is within the set of conditions that are "automatically unfair" is "Assertion of statutory right",
(1)An employee who is dismissed shall be regarded for the purposes of
this Part as unfairly dismissed if the reason (or, if more than one,
the principal reason) for the dismissal is that the employee—
(a)brought proceedings against the employer to enforce a right of his
which is a relevant statutory right, or
(b)alleged that the employer had infringed a right of his which is a
relevant statutory right.
However, the reason for being fired in this case has nothing to do with bringing proceedings against the employer, or alleging infringement of a statutory right. As far as I can determine, being fired because you quit is not deemed automatically unfair in the sense of short-circuiting the two year employment requirement; and for an employee with less than two years of service, no justification is necessary.