Spontaneous light-mediated magnetism in cold atoms