In BG2 it was a matter of alignment and reputation. Evil characters would complain and then leave if you became the paragon of good and good ones if you became a despicable villain. Neutrals were slightly more tolerant to good and would only depart at the lowest possible reputation. You can see the table
here.
As for BG3: Swen has said the companions very much have their own minds and will ditch you or even try to kill you if they hate you enough. (Source:
this video 12:24.)
Regarding more companions... From what we know now, we're going to get those 8 origins, as well as customizable generic mercenaries (and custom party created at the start). Previously (Reddit AMA) they've stated that they want all companions as origins, but it seems they may be reconsidering adding non-origin ones (one of the post-EA-launch interviews, I believe). I very much hope they're going to add a lot of non-origin companions of various "richness". I personally like companions that are more "special" than your Average Joe (though it really depends on the execution), but I'm not really a fan of any of the ones we've been shown. The horniness doesn't help.