The question leaves to guess what the compression function is, and how it uses rounds. That being unspecified, no, increasing the number of rounds in the last compression function is not guaranteed to prevent length-extension attack, even if the compression function is changed and rather improved by adding more rounds to it.
Proof by counterexample: modify SHA-512 by
- removing the exclusive-OR at the end of each compression function, in effect utilizing the block cipher of the Davies-Meyer compression function directly as the compression function;
- and modifying the key schedule of that cipher so that it repeats after the number of rounds used in the block cipher of the compression function (but that block cipher is otherwise secure)
- and doubling the number of rounds in that block cipher in the last compression function, reusing the same constants as in the first half
That combination in effect hashes twice the last block of the expanded message, and uses a compression function that's reversible. That leaves the hash theoretically weakened against some attacks, but still unbreakable from all practical standpoints. And that leaves it vulnerable to length-extension attack in some cases. For example, when the unknown input is one message block (128-byte) and we know it's hash, we can compute with certainty the hash of a 3-block (384-byte) input starting as the original, followed by twice the known block equal to the padding block of SHA-512 for 128-byte input.
On the other hand, if the change we make in the last compression function makes it essentially unrelated to the normal compression, yes we are demonstrably safe from the length-extension attack. Changing the constants used at each round of the block cipher of a Davies-Meyer or Matyas-Meyer-Oseas compression function as in SHA-2 (without changing the number of rounds) would do, beyond reasonable doubt. So would doubling the number of rounds and using new constants in the second half. I make no statement about doubling the number of rounds with the same constants.