I moved from a house with huge yard to an apartment with a malinois and a big mutt, for much the same reason you list. The dogs didn’t miss a beat, and in fact seem to much prefer the apartment life- they enjoy hanging out on the balcony and watching the kids play and the neighbors go by, and they really enjoy going for extensive sniff-walks on the heavily used sidewalks and trails, meeting the neighbor dogs and neighbors, visiting the local green spaces, etc.
They actually get a lot more exercise/mental stimulation now, in the apartment, than in the house- at the house, each day they got a good run, training time, and some yard play time; at the apartment, each day they get a good run, training time, some yard play time, plus three or four walks, plus hanging out on the balcony watching the action. No action at the house, it was dead quiet, nothing ever happened, nothing much to do out in the yard if some human didn’t come out also to play with dogs.
I watch the dogs in the neighboring houses + yards, and the dogs in the apartments, and almost universally the dogs in the apartments seem to get more exercise and mental stimulation than the house dogs- the house dog owners tend to just chuck them out in the yard to be bored, while the apartment dogs get walked and played with.
As a dog OWNER though, it is much easier to just have that yard- particularly when it’s pouring rain or freezing cold at last-night potty time, and you wish you could just open the door for them without having to go out yourself.
But the dogs, they will be fine anywhere as long as their owner makes an effort to meet their needs.