Harden resolveVirtualMethod against invalid types (dotnet/coreclr#9989)
Split resolveVirtualMethod into a wrapper/helper to allow early
returns as failure reasons are discovered.
Before devirtualizing, ensure that the derived class claimed by the jit
is really a subclass of the class that introduces the virtual method.
Fail early if this is not the case.
Also add early out for interface call devirtualization. The jit currently
does not ask for this but asking for it should not trigger an assert.
Closes dotnet/coreclr#9945 (along with dotnet/coreclr#9959).
Commit migrated from https://github.com/dotnet/coreclr/commit/
8902cdb044587ec713f25cb2a137b9532b98e7a2