It only corrodes if it's not completely encased in concrete. The concrete stops the reaction. And, if one portion of the rebar is not encased it will eventually corrode through overtime.
Inside the concrete, Ca(OH)₂, which is generated by the hydration of cement,
creates a strongly alkaline environment, with a pH value of more than 12.7.
In this environment, a passivation film forms on the surface of the rebar to
prevent corrosion. However, the pH of the concrete decreases as micro-cracks
develops and chloride from the outside infiltrates the rebar. Eventually, as
the environment inside the concrete becomes neutralized, the corrosion of the
rebar accelerates, which reduces the overall durability and stability of the
reinforced concrete structure.
https://www.sciencedirect.com/science/article/pii/S095006182... A sighting of preserved steel reinforcing bars sticking out of old concrete
rubble piqued the curiosity of our company founder, Albert C. Bean, Sr. After
investigating this finding, his company, Armor Oil & Chemical Company, began
producing a patented cement-filled coating formulation that, in its updated
form, still protects structures from corrosion today.
https://tnemec.com/about/