How do people claim precedence with their unpublished scientific theories?
If the paper was rejected the journal still should have the archive where the manuscript and all communications are preserved. If the paper was rejected and was actually a good paper ahead of its time it will be of great interest to investigate why it was rejected. Of course the more time passes the greater risk that this archived information may be lost but in 10 years it is unlikely.

It is likely that both persons will be mentioned in the history books. The person B may be still considered more important because it was his/her work that actually influenced the scientific community. There were a lot of examples in the history of science when even published work was unnoticed and only later independent work attracted interest. Concerning Nobel Prize... Well, it will be decided by the Nobel Committee that will not surprise anyone by surprising everyone.

Nowadays one can easily share the work placing preprints into a public repository like the mentioned arXiv (where some subjects like gen-phys have a reputation of having quite a low bar). One can also put a preprint into some sufficiently trustworthy repository like one owned by the institute. In the old days before internet preprints existed too. They were sometimes printed as small booklets by the author or printed by the institution. The problem with preprints is that while in theoretical physics it's almost strange not to publish a preprint and journals often encourage and sometimes even require that, in other fields journals sometimes may treat a preprint as a prior publication.

Some priority may be claimed if the work was presented at a conference and something like a presentation and numerous witnesses are available. However this is really unreliable.  Because often much less evidence can be provided there are a lot of instances when people claim that some of their unpublished work was stolen and of course no one can prove anything. On the other hand if the work was published as some sort of proceedings (that often have no real peer-review) this claim may be quite solid.

Then there are personal notes and letters that are used by historians. However it is really hard to use it to claim priority when actual interest of living people are involved. Though I remember a smart trick in the history of aluminium electric extraction - one of the authors sent himself several of letters safekeeping the unopened envelopes with official mail stamps and then successfully used those in court to prove his priority.