The military production is not coming out of any other queue, it just doesn't happen if you don't assign a shipyard. So, technically, you aren't wasting anything. If you can't help yourself and are that worried about wasting the ship production, either assign the planet to a distant shipyard and live with the distance decay or else build yourself a shipyard. If you don't need yet another shipyard, then you don't need that extra bit of production to win the game. Give up your min/max optimization obsession and let the extra hammers go. They aren't worth the bother. Not that I don't find this difficult myself, you must understand, but it is really the only answer. Don't sweat all the available nits you can pick unless you realize that is how you have fun. In that case, build a shipyard and make Treasure Hunts there, that is one avenue I have followed.