As far as can be understood, the immune system does random self-mutation of its antibody generation and starts picking winners at local maxima.
The result is antibodies start targeting various parts of viruses, bacteria, and other invaders.
Binding and neutralizing the spike protein neutralizes the virus, so the vaccines used it. Upside: immediately effective vaccine. Downside: Its possible random antibodies in natural infection could target another critical protein to covid19 that is not on the spike, but also shuts down replication.
So that's also in the field of study for covid, as well as influenza, vaccines. Is there some part of the viruses we could target instead of the spike(or the influenza hemagglutinin) that would cause immunity against the entire class of virus? Such is the search for a universal influenza vaccine.
The goal here is probably more characterization than discovery. For instance, here's a higher up Google result for "antibody heterogeneity" published in 1966:
The article tells about three different specific antibodies, targeting RBD, N-terminal domain, and S2 part of spike.
T-cells are even more amazing in the way they target portions of proteins that are vaguely similar. So you could be exposed to some pathogen A, and have T-cell immunity and recognition against some pathogen B (which is quite distinct and different from A).
https://med.stanford.edu/news/all-news/2013/02/immune-system...