Is there an "opposite" to the idiom "throwing the baby out with the bathwater"?
Solution 1:
You could try "cut off your nose to spite your face".
This is used where you bring a lot of trouble on yourself pursuing a minor victory, such as getting even with somebody. As it has this 'angry' aspect, it might not be exactly the same as throwing the baby out with the bathwater, but I can't think of a closer one.
Solution 2:
Based on your second paragraph, I think a Pyrrhic victory might qualify:
Someone who wins a "Pyrrhic victory" has been victorious in some way; however, the heavy toll or the detrimental consequences negates any sense of achievement or profit.
This doesn't necessarily capture the aspect of "obtaining something that is wanted (and relatively minor)"; however, I don't think the original idiom always reflects that either.
For instance: "To suggest eliminating all military spending to meet defense budget constraints is throwing the baby out with the bathwater". Many might not see budget cuts as "minor", but the proposed solution is nonetheless extreme where the costs may outweigh the benefits.
Solution 3:
A traditional metaphor is "sow the wind and reap the whirlwind".
As noted in the linked Wikipedia article, the origin is the "Book of Hosea", part of the Hebrew Bible.
Solution 4:
"House rats with hand grenades" has an idiomatic ring to it and is completely understandable even though I've never heard it before. It might not be useful for formal speech, but neither are most idioms.
Solution 5:
There is an expression ''using a sledge hammer to crack a nut'' which is similar to your hand grenade example but not exactly what you asked for in your opening sentences.
Another expression ''be careful what you wish for'' generally means that getting what you desire may have unforeseen consequences. This may be closer to what you are looking for.