I think you misunderstood what they said (or they said it badly) – they dont need you to be in a single contract for 2-3 years, but they do need you to have 2-3 years worth of steady accounts (and therefore contracts) that they can use to be confident that you can repay the loan.
There are specialist mortgage providers who will loan you money with less than 3 years accounts, but you’ll pay more for the privilege.
I’m a contractor (have been for 18 years), and all my mortgages have been with the regular mortgage providers, no specialists needed.
This is probably too late for you, but If you’re going to go contracting and you know you’ll want to remortgage/mortgage in the next 3 years, then get the mortgage lined up before you jack in your permie job. This is one of the downsides of contracting.