I have lived in San Francisco for 53 years. I'm sad to say that over the last few years, I have had a firsthand perspective on this decline that you describe. I am saddened to say that it is all true.
Not to defend what is happening here, but I will point out that this is the sad state of affairs in many other places around the country. Portland, OR looks the same.
Despite all this, for many reasons, it is the ideal place for me to live. I explain this in a piece I published right here on Medium: https://jaydavidson-sfo.medium.com/im-staying-in-san-francisco-because-it-s-the-perfect-place-for-me-7b8b0b679458