you don't want to remove 100% since you want to charge the batteries somewhere. Also it maybe more economical to keep 1km of power lines after the station when the train is accelerating - main power consumption.
This would be so much simpler than electrifying the whole line and much easier to maintain.
This infrastructure is often already at key stations, and so it might require no extra work to implement them. Just more money for the battery powered trains.
edit: also I don't think your idea will 100% work because it would take some time to charge the trains at the stations.