Legal aid dispute could result in dozens of people accused of crimes avoiding custody as they await trial