Cheese and onion is the plain cheese sandwich given a single deliberately aggressive counter, and the onion is doing a job no pickle or sauce quite does. Raw onion against Cheddar is not a mellow addition: it brings a sharp, pungent, slightly hot bite and a wet crunch that cuts straight through the fat of the cheese and the softness of the bread. The whole sandwich is built around that confrontation. A firm sharp Cheddar can take it; a mild cheese is simply flattened by it. The onion is the assertive partner, and the defining decision in the sandwich is how much of that assertion you are prepared to carry.
The craft is managing an ingredient that does not sit still. Raw onion sliced thick delivers a punishing, uneven bite and slides out of the sandwich in rings; sliced thin it distributes its heat evenly and stays put under a top slice. The cut is one lever. The choice of onion is the other: a strong brown onion is the full unmediated version, a milder red or a sweet onion pulls the heat down without removing the structure, and a quick rinse or a brief soak in cold water takes the harshest edge off for those who want the crunch without the burn. The cheese is cut thick enough to stand as a wall against the onion rather than be overrun by it, and butter to the edges bridges the two and waterproofs the crumb against the onion's moisture, which is real and which will weep into the bread if it is left to sit. The bread is soft and plain because the build already has its loud note and does not want a second one from an assertive crust.
The variations are mostly about taming or moving that onion. Pickled onion swaps the raw heat for a vinegar sharpness and a different crunch. Sliced onion sweated soft turns the whole sandwich gentle and savoury. The grated, mayonnaise-bound cheese savoury folds onion into a paste so the bite is everywhere and nowhere at once. Each deserves its own article rather than being crowded in here.