Considering I could just say "I quit" and do the same thing, yes.
Your contract covers this scenario however. That is, both parties agree that you quitting is an acceptable outcome. Most places will require a minimum of X weeks notice (some as many as 3 months in very senior roles) to aid the handover of responsibilities and find replacements. There is a distinct difference when the termination is a surprise, and not a result of breaking the contract. If an employee does something in violation of their contract, sure, instant dismissal is expected, and there is an assumption the employee either knew or was at fault for not realising they were breaking contract.
Most countries have laws about company-initiated termination because in the average work environment the business has greater power in the relationship than the worker. The laws are there to ensure companies (which have no inherently moral outlook... in my experience, often the opposite) can't abuse their position in this negotiation. The cost to dump an employee helps force companies to prefer to upskill and re-allocate individuals, rather than wholesale firing cycles.