Can you briefly sketch the sequence of math theories that were necessary for Einstein to figure out a convincing background for relativity?
There are two theories which are called "relativity".
Special relativity. It required no advanced mathematics at all. Minkovski space, as a proper mathematical background was proposed after the theory itself.
General relativity. Mathematical background is Riemannian geometry. Riemannian geometry was proposed by Riemann, as a very general outline in his lecture in 1854, and the technical development is due to Riemann himself, G. Ricci-Cubastro and his student T. Levi-Civita.
All this has nothing to do with Cantor.
EDIT. Cantor first paper on set theory was published in 1874. But his ideas were not immediately accepted: the ideas of set theory begin to penetrate the mainstream mathematics only in 20th century. The "revolution" happened much later. Riemann died in 1866.