Axion-induced topology change in quantum gravity and string theory