Same thing happened to me after I changed my AppleID password, I could not log into iCloud, but could get into the iCloud.com/photos, iCloud.com/mail etc... Note, this is not my primary AppleID. After a couple of hours of looking for a solution (y'all know how it is:) ),I found something someone els wrote and it worked!
I had to delete my internet account for this id and then add it back. When I added it back, i had to agree to the terms and conditions; then I was able to login into iCloud no problem. A couple of things to note, I removed and re-added the AppleID from my macbook (it should work on phone or ipad too, at least one would think), also when I added the AppleID back, the "logging in" message kept showing. After a couple of minutes, I did a Force Quit (command-option-escape) to close the system settings. Hopes this helps and saves some time.