A firewall would not mitigate a vulnerability of Apache, however it might very well make it harder for the attacker to connect to a remote shell that they open on the server after exploiting Apache.
Unless the attacker would be able to get root on the box via a privilege escalation vulnerability, they would not be able to disable a firewall that blocks access to ports other than 80.