The bank can’t sell the loan to a GSE without meeting certain specific guidelines. Less of an issue if the bank keeps some of all of the loan on its own books. So yes, banks can and will, but you have to work with a bank that can be flexible.
Also, keep in mind that the California Homerenters’ Bill of Wrongs hasn’t made it terribly easy for a bank to “just foreclose” and get their money back at the sheriff’s auction.