Foam is quick and cheap, which is why it is so popular for filling holes. Unfortunately it is also easy for a rat to chew through.
Expanding foam sets soft. Rats gnaw to keep their teeth worn down, and a foam plug is easy to get through, sometimes in a night. It can also shrink or crack and leave a gap.
A metal mesh or plate set into the opening, with hard filler around it, gives a barrier that cannot be chewed through. Foam is fine as a backing behind the barrier but should not be the barrier.
If a hole has been foamed before, inspect it for gnaw marks. A foam plug with droppings next to it has already been tested.
Yes, as a backing behind mesh or hard filler, but not as the only protection.
Properly fitted mesh and hard repairs should last for years, but check them after building work.
Tell us what you're seeing and where, and we'll get back to you with a clear price.