If I have someone I consider a friend, we have got to know one another over the years, we hang out and share personal information and confidences, they have been in my home etc and are always welcome, I would be very disturbed if that person would not allow me in their home and had never explained why.
My friend I mentioned way up thread (had never been in her home but gave me her key and asked me to do something in an emergency - found squalor, filth, stench, infestations, floor to ceiling, hoarding for 20+ years) should have told me about the state of her home IMO as it was dangerous and badly infested in a way that could have affected me and my life and my home. Also she had her son and cats living in there. I can't believe she herself was living in there - it was like one of those extreme hoarding USA progs.
Obviously I have total empathy and there's been many times in my life that my flat has been so messy or unkempt that I'd be mortified if anyone needed to come in (but, personally I would let someone in to use the loo as I feel it's a medical need).
It's a massive part of someone's life when they're living like that and clearly they're in denial or something but for me it would be a game changer and put the friendship in a whole different light. Especially as this one in my example was quite bitchy and grandiose and snarky. When she said 'never come to my home unexpectedly' I assumed she was being snobbish and lording it over me like she did sometimes.
Instead she was actually profoundly mentally ill and I would have been kind enough to try and support or help her. It ended our friendship as I refused to go back into the house (due to infestations and other hazards) and she bizarrely and incorrectly assumed I'd lost her door keys so we argued and drifted apart after that, never seen her since.