White Flag
The most relevant topic to this is White-Flag. Before white-flag, the coordinator would make certain that between two milestones there we no double-spends. White flag removes the responsibility of the coordinator to check for double spends. All it does is issue a successive blocks to create a strict total-order of milestones.
White Flag, allows milestones to confirm conflicting bundles by enforcing deterministic ordering of the Tangle and applying only the first bundle(s) that does not violate the ledger state
White flag implements a mechanism that deterministically orders the tangle based on milestones, removing responsibility from the coordinator to check for double spends. Double spends can now be resolved by each node independently and deterministically.
Ordering the Tangle
The mechanism mentioned above is:
The topological ordering generated by a post-order Depth-First Search (DFS) starting from a milestone and by going first through trunk bundle, then branch bundle and finally current bundles.
The milestone just allows a stop condition to DFS allowing all nodes to resolve double-spends by only validating the first one. This also means that each milestone is required in order to make transactions confirmed because thats when DFS is initialized to order the tangle.
Conclusion
If the coordinator stopped existing, nodes would stop confirming transactions. If the coordinator issued bad transactions, that means they have the wrong private key and nodes would ignore them; resulting in all transactions not confirming. In either of these cases, the IOTA Foundation would issue new coordinator keys, node operators would update them and listen to the new coordinator. The coordinator is necessary for a total order, just like blockchain, but the role of the coordinator is nothing more than issuing checkpoints/milestones every 10 seconds for nodes to reference.
It is much harder to remove the coordinator than it seems but the IOTA Foundation, has done a great job with Over The Tangle voting and FPC to find away for nodes to deterministically order the tangle without the coordinator.