I’m not your lawyer; you’re not my client; I know nothing about any relevant area of the law; what follows is not legal advice.
If your in-laws give your wife $300K, that’s her separate property. None of it is community property. If your wife then uses that money to buy a house worth $300K, that house is her separate property. I’m not sure where you get the assumption that it would be partially community property (unless there’s a typo, and you meant to say a house worth $600K, in which case, yes, the half bought with your wife’s inheritance is hers, and the half bought with community assets – your combined paychecks – is community property).
The issue is what happens upon divorce, particularly since community assets would be used to pay the upkeep of the house, including property taxes. Generally, courts address those matters “equitably,” i.e., by looking at what would be fair, but they also “trace” the community/separate assets and determine precisely what went where. I haven’t looked at these issues since I took the bar, and since I didn’t go to school in California (or one of the other six or seven states that has community property) I never studied the issue in school. My memory, though, is that it can get kind of complicated when you divorce and have to divide commingled assets.
Me, though, I’d do it anyway. If you’re not going to divorce the wife, it’s all a non-issue. If you do end up divorcing, at least you’ll have some interest in a house to fight over, whereas if you don’t take the money, you’ll end up divorced and without a house.
I do think the in-laws are a bit, um, protective of their daughter, to insist on a contract. I will say, though, that I’d definitely get a lawyer involved to look that over before signing. And remember – your wife always has the power to convert that separate property into community property. So it may well be that a few years from now, your wife will think, “well, this is dumb” and transmute the house.