Suppose that A continues to manage company B while disqualified, by
arranging for (and signing on behalf of) B to borrow money from C. If
C sues B to recover the loan, can B argue that it is not bound by the
contract because it was illegal for A to sign on B's behalf?
The fact that the person who signed a contract couldn't legally have authority to execute the contract on behalf of a company doesn't mean it is an "illegal contract".
Whether a contract is illegal or not goes to the subject-matter of the agreement, not to the means by which it is entered into.
A contract on an otherwise valid subject-matter is not invalid on the grounds of illegality merely because the circumstances under which the contract was entered into were irregular or illegal, whether the problem with the entering into the contract was duress, abuse of a confidential relationship, minority, lack of authority to do so within the company, failure to memorialize the contract in writing when it is required by law, or what have you.
Unless there is clear statutory direction to the contrary in Australian law, the analysis here would be the same as the analysis under the common law of agency that applies in any circumstance where someone purports to enter into a contract on behalf of a principle (such as a company) without the legal right to do so.
This rule is that the company is bound if the person had "apparent authority" to enter into the contract on behalf of the company and the connection between the company and the person claiming to act on its behalf was not totally made up (i.e. that the company had done something that contributed to the appearance that someone who was in some way connected to the company has the authority to take action on its behalf by not being clear enough with the outside world about who has authority to do what).
So, absent clear statutory authority to the contrary, the company would be bound by the contract vis-a-vis the third-party on the other side of the contract (assuming that the counterpart to the contract didn't actually know that the person they were dealing with was disqualified), even though the person entering into the contract didn't have "actual authority" to do so, because that person was prohibited under the Australian Company Law from exercising that kind of authority.
The company could still sue the disqualified person who entered into the contract for any harm suffered by the company as a result of the disqualified person's failure to disclose to the counterparty in the contract that the disqualified person didn't have the authority to enter into the contract. But that would be it and would only be available if the company actually did suffer economic harm from being wrongfully bond by the contract.
The disqualified person could also be criminally prosecuted for entering into the contract.
Now, some kinds of improperly entered into contracts aren't subject to a rule as unyielding or harsh as the apparent authority rule, and I wouldn't be shocked if Australian courts chose to deviate from the apparent authority rule in this particular case.
For example, another possible analogy would be a case where a minor enters into an executory contract (i.e. one that is not fully performed by both parties contemporaneously when it is entered into like a purchase of goods at a retail store), that is not for "necessities", rather than under the agent without authority to act under internal corporate allocation of responsibility to employees analogy.
In the contract by a minor case, the contract improperly entered into by the minor is not automatically void ab initio, but it is "voidable" by the minor. In other words, the contract could be undone, or there could be a defense to a lawsuit to enforce the contract, if the minor, properly represented by a guardian, wanted to do so.
Contracts entered into under duress, through fraud in the inducement, and as an abuse of a confidential relationship, for example, are similarly not "void ab intio", but are "voidable" in the same way as a contract entered into by a minor who did not have the capacity to do so.
On the other hand, if some random third-party in an act of outright fraud, who has no connection to the company, purports to sign a contract on behalf of the company, that contract is void ab initio and has absolutely no force or effect. This is treated legally as if the purported contract formation never happened and can't be enforced by either party to the contract.
I don't have access to Australian legal authorities sufficient to determine definitively if this situation under this particular Australian statute is governed by the apparent authority rule of agency law, or by the voidable contract rule that applies to other contracts with legal subject-matters which are entered into improperly. But, the basic legal theories involved and the main possible legal conclusions are ubiquitous for how the common law of contracts and agency handles this situation in all common law countries where statutes don't expressly provide otherwise.
Does the answer depend on whether B "allowed" A to illegally act on
its behalf (for example, because A was the sole director and
shareholder)? Would it be different if there were other directors who
tried to stop A from purporting to act on behalf of B?
Somewhat. If B allowed A to illegal act on its behalf, it would probably be governed by the apparent authority rule. And, if other directors tried to prevent this in a way that wasn't effectual to advise C of A's disqualification, that probably wouldn't matter in lawsuits vis-a-vis C.
Does the answer depend on whether C knew that A was disqualified from
managing corporations? What if C knew about, or turned a blind eye to,
B's internal management problems because C stood to earn a high
interest rate?
Yes, this matters. If C knew that A was disqualified or was on inquiry notice due to suspicious circumstances that he might be disqualified and ignored those circumstances, the contract would be void or voidable.
What if the loan was in the other direction? If B sued C to recover a
loan, could C refuse to pay because A was disqualified from lending
B's money in the first place? Would it matter whether C was aware of
A's disqualification?
Generally speaking if C agreed to pay the loan, the fact that A was disqualified wouldn't matter. If C was aware of A's disqualification, B might have a right to bring a lawsuit against both A and C for fraud or conspiracy to commit fraud, in addition to the right to bring a lawsuit for breach of contract or unjust enrichment for failing to repay the loan, which might conceivably provide B with addition relief or remedies (e.g. it might impact thee way that the debt was treated in a bankruptcy if C went bankrupt).