...is it really always stupid to own your primary residence?
No.
If it is cheaper than renting what your family needs -after factoring in buy/sell costs, maintenance, etc- then no.
Needs may include disability stuff, proximity to family you're caring for, only option near a site-specific job, etc. Some things may be harder to find in the rental stock available in the area you need or want to be in.
And also, what are some (non-emotional) benefits to owning your primary residence?
1. For some people, it is literally the only way they will put any money aside. They won't put an amount into savings or investment monthly, but they will make a mortgage payment. It may be good for them.
2. You may have a vote in a strata council, HOA, municipal water tax issue, etc. For me, such a vote isn't worth enough, but if you've got enough likeminded people in the same area, this could have a benefit.
3. As you note, you may be able to stay "no matter what." Personally, I didn't like having to stay no matter what and prefer the mobility of renting. But if "stay no matter who moves in around you, what developments go up, etc" is important to a person, that could be experienced as a benefit.
4. Sometimes housing in a given region climbs faster than stock values, so a person could potentially benefit that way. (I did. But it's a gamble, and not something that can be foreseen, planned, or counted on. And taxes go up with it. That's why I still don't choose it.)
5. When the house is paid off, continued costs (taxes, insurance, maintenance, etc) may be lower than rents in the area. I don't think the math generally works out for that, but some people like it. But I guess that's more an emotional benefit, and you were looking for other ones.
6. In some cases, you can rent space out -a parking stall, garage space, an indoor room, etc. Granted, you can't do that in all owned places (most of my area) and can do that in some rented ones, but depending on the region's laws, there could be a benefit.