Some bolts on bicycles are critical, others not. I consider the stem bolts that hold the handlebar in place as critical, as well as the seatpost bolt. I won't die if I break a crank bolt but if the handlebar comes loose whilst sprinting you will die. I know, I'm now on my second life.
Critical bolts are made from high-tensile steel and then chromed. It may seem obvious that the bike company should just have fitted stainless steel bolts in the first place but there is method to their frugality. Stainless steel bolts are not high-tensile and cannot withstand continuous cyclical stresses such as those experienced by seatpost clamps and stem clamps. A rusty head is a small price to pay for safety and reliability. The reason the heads are rusty inside where the allen key goes is because such a recess is a Faraday shield and the electroplating doesn't work so well in there.
I would replace high-ten bolts with stainless on my bike only if there is redundancy. Some stems have a front loader cap with 4 bolts. I may risk stainless there if they are four 5mm bolts in there but not 4 x 4mm ones. Seatposts, never, but that's just me.
Further, if you are going to replace paired bolts with stainless ones, make absolutely sure you torque them up incrementally and evenly. It is very important that in a stem clamp, all four bolts are evenly tightened otherwise one of them strains more than the other and fails quickly.
Not everything is what it seems to be.