Why does the addition of noise improve coherence between two signals?
To elaborate on @user28715's answer:
Even with a minuscule amount of noise say An = 0.0000001 you will get a clean graph like your first graph. Python's implementation of the Welch method certainly uses finite-precision floating point numbers and quantization errors in the input and from the calculation steps such as windowing and Fast Fourier Transform (FFT) propagate to the results. From SciPy docs:

Cxy = abs(Pxy)**2/(Pxx*Pyy), where Pxx and Pyy are power spectral
density estimates of X and Y, and Pxy is the cross spectral density
estimate of X and Y.

The normalizing division in the equation means that the values of Pxx and Pyy can be arbitrarily close to 0 while still giving large Cxy.