A series of novel comb-like poly(butyl acrylate)-g-poly(dimethylaminoethyl methacrylate) (PBA-g-PDMAEMA) with different side chain lengths were designed and successfully synthesized by the “first main chain then side chain” method. Infrared Spectroscopy (IR), 1H Nuclear Magnetic Resonance (1H NMR), and gel permeation chromatography (GPC) were used for structural confirmation and molecular weight characterization. This polymer exhibited responsive behavior from hydrophilicity to hydrophobicity under the alkaline environment of cement-based materials, with the contact angle of 105.6°, a decreased evaporation rate, and a hydrophile–lipophile balance (HLB) value. A significant internal hydrophobic effect on cement mortar was shown in the water absorption rate, which decreased by 75.2%, and a dry shrinkage-reducing rate of more than 30%. Furthermore, this polymer can effectively slow the exothermic rate, reduce the heat release, and delay the exothermic peak of cement hydration. It was interesting that these properties showed a direct correlation with the side chain length of the comb polymer. The aims of this study are to provide a new avenue to synthesize polymers with the spontaneous hydrophilicity–hydrophobicity transition in the cement system, achieving excellent internal hydrophobicity of cement-based materials, and to offer a promising alternative to resist external erosion for improving the durability and service life of cement-based materials.