You're spending the $12M for something. A healthy org would consider it a sunk cost if he tanks, but can also justify the investment if it indeed does have the effect of galvanizing the back end of the staff for competition.
If they hit Keno on Gallardo (lottery would be young Gallardo), great. If you don't and you are willing to jettison him, the message to the waves on the way is that your performance matters. Entitlement can still be a factor (which it should - you don't jettison Cano because of a bad April/May), but it doesn't preclude you from always looking to put your best 25 out there. If a $12M investment gives the competitive atmosphere you want, do you do it?
From the outside, it's easy for us to want to control the M's money based on what we think they should do. In a vaccuum, the Gallardo contract makes no sense. In context, it still may not make sense, but if it has other desireable consequences for the team, it just might.