Why do freehub and cassette have only one position that matches?
Early cassettes (Suntour Accushift and Shimano Uniglide being some commonly encountered examples) weren't like this. The splines were all the same and there was no hunting for the little spline or big gap. 

To summarize a bunch of history, these cassettes were current at the same time as early indexed shifting. Accushift and early Shimano SIS both functioned, but not all that well by modern standards. The cog teeth on some of them had various thinned out or axially twisted bits to act as a primitive shift aid, but they were substantively like the freewheel cogs that came immediately before them.

Arguably the key innovation in Shimano's entire history, the first Hyperglide cassettes were released in 1989. Hyperglide uses a system of mapped-out chain exit and entry points (the different profiled teeth on modern cassettes) along with pickup ramping on the sides of the cogs to facilitate smooth shifts that demand a bare minimum of finesse on the part of the rider. It's the piece of the puzzle that made indexed shifting start working really well, and has been universally copied. But by nature, in order for it to work, the cogs have to be in an as-designed position relative to one another. Hence all modern cassettes only go on one way.