United Flight 59 took off from Frankfurt, Germany, on Friday afternoon and was headed for San Francisco, California, before it had to reverse course a couple of hours into the flight, according to German news outlet Bild.
It would if it were an emergency. Airlines typically get their non emergency work done at their own hubs where it costs less as opposed to paying a foreign contractor. Toilets don't suddenly break overnight especially on a plane that costs 100s of millions of dollars. SFO maintenance may have been aware of the problem and chose to defer it, or worse may not have caught it during scheduled inspection. Notice how most of United's problems of late involve flying in or out of SFO where their largest maintenance facility is located.