A way to avoid this would be to not take any any credit lines or credit cards with your credit union if you also owe them on a car loan. Alternatively, prior to filing bankruptcy, you could refinance the car loan with another lender and effectively "take out" the credit union. If at the time the new loan "takes out" the old loan the credit union does not ask that the new lender also pay off the credit line/credit card, then you will likely be in the clear and the credit union will effectively lose its "collateral" for the credit line since they will have released the collateral that was the subject of the security agreement.
Another thing to look out for is that more and more credit unions are starting to close people's bank accounts when they file bankruptcy if there is also a balance owed. So, prior to filing bankruptcy, you may want to switch your checking and savings accounts to a bank where you don't also owe money, along with switching your direct deposits and bill payments. Unfortunately, non-credit unions are also starting to close checking and savings accounts as well when a person files bankruptcy and owes the bank money. Since, in my experience, no credit union or bank is uniform in their policies with respect to this issue, it's impossible to predict who may do this and to whom. It is just something to be alert about and something you may want to address prior to filing your bankruptcy case.