Yes and no.
They didn't have almost the same yardage, Cook had 290 less rushing yards. He averaged 63 rushing yards a game, it would have taken him nearly 5 games to catch that total up. Williams has the higher snap count because he can be trusted in more situations.
A RB who has more rushing production, more established rushing production, and is trusted in more situations is likely a better RB.
If Williams is getting 11 AAV, Cook really doesn't have much ground to stand on to get 15m. 11m for a guy who plays 48-52% of your snaps is also a lot.
I like Cook, but I feel like his contract will age like milk.