What kind of vagrants? There used to be tons of roma people panhandling but they aren't homeless, and since the pandemic they're much less numerous (I'd guess I see less than a 1/5 of what I used to).
I really don't think you saw "plenty" of homeless on the streets here, not now and not a decade ago. Panhandlers, beggars, etc. do exist but they aren't homeless.
I do not trust your anecdotal experience, not saying the issue doesn't exist but it's not even close to a problem and orders of magnitude less than anything I've experienced traveling in the USA, around the Bay Area, Texas (Austin/Dallas), New York, Portland, Chicago, Detroit, Boston, and a few other places had a very acute and visible issue with homelessness that's incomparable with Stockholm.
So yes, public services being properly funded help a lot.
If you’ve cleared it all up since then, kudos. But I don’t think it’s because public services were underfunded back then.