Friendship takes time, less busy dorfs make more friends, but they have to be not busy at the same time repeatedly, like my bonecarvers were off-duty for a year or two and each have 6-7 friends, and are often the sole friend of each of them because everyone else isn't regularly off work at the same time as their passing acquaintances. The spinners only work once a year so they have friends.
Anyway, dorfs have needs. Lots and lots and lots of needs, that all take time. In 44.11 if things are bad for a dorf it's not just bad thoughts, they also are stressed (distracted) by unmet needs. Every single thing they can't do that they want to do is a minor or major bad thought depending on how much they want it, and there's a ton of them.
Here's one I've had in caged for a couple seasons, and he was unhappy before that, obviously. Things that are distracting him.
Away from people. <- dwarfs need company.
Unoccupied. <- dorfs need work.
Unexciting life. <- many dorfs like trouble, get them in the military.
Unable to aquire something. <- oops, don't turn on the economy.
Kept from alcohol. <- obviously, dorfs like booze, there's a lot of happy thoughts for booze and mugs.
Lack of decent meals. <- cooking seeds is something I need to stop.
Unable to fight. <- angry dorfs get happy thoughts from brawling, and sad thoughts from not brawling.
Lack of trouble-making. <- seriously, this guy ...
Unable to argue. <- that's another possible happy thought for a couple angry dorfs.
Not learning anything. <- LIBRARIES! Almost everything that's a happy thought is also an unhappy thought for not having it.
Unable to help anybody. <- everyone bringing him water and food avoids this one, most dorfs don't care.
Unable to make merry. <- that's getting proper drunk, dorfs can only do that in pubs, .
Unable to admire art. <- come on, it's a lovely cage.
Unable to practice a craft. <- lots of dorfs need a craft job, over a few years this one gets bad.
Being away from friends. <- the downside of making friends, they still need time off.
Unable to practice a martial art. <- lots and lots of dorfs want to be in the military, others hate the draft.
Unable to practice a skill. <- skill rust, they all hate rust.
Unable to take it easy. <- no time off, dorfs must have time off, busy industries must have a large excess in workers.
Unable to pray to Kikrost. <- temples, just so important. Not at all optional, it's a big happy thought and they hate not getting it.
He would also be upset by going outside or getting rained on, but prison prevents that.
All of those things accumulate for the dorfs that feel them. The longer they don't have a skilled job to do, the worse that unmet need gets. Over a few years, a lot of them can add up to big stress.
So they need a pub, and a temple, and a library, and work that usually must include a skilled job, and they have to be able to do the jobs so the skills don't rust, and they want military service, and time enough to get around it all. If they almost get a bad feeling about lack of prayer or chilling out, they pop up a purple job and go do it, but some dorfs are a bit keen and will end up hauling all the time and not taking breaks for that stuff.
If you make those super-optimised forts where everyone is busy all the time, you'll get a lot done, but they won't make friends, they'll get a bit sad, only get the purple breaks and probably not near enough of them if they are of certain personality types, and if anything bad comes up like a sentient corpse pile, it'll drop them into high stress and they won't be able to get over it. To some extent, only your military should be hauling bodies anyway, it's unlikely for others to have the Willpower or Discipline to handle it well. Though I've found leaving a few dead dogs out where everyone can see them gets them into being less freaked out by death in general.
My happiest dorfs all have skilled jobs where they make masterworks and have some time off, and some time on. They're busy enough but not too busy, so they get around all the legendary rooms that give them a bunch of happy thoughts, and more than just once a year or so, and that lets them make friends too.
TLDR: If none of your dwarfs are making friends, it's a bad sign, and they probably have a lot of other unmet needs they also don't have time for.