Now, some of the other 29 states plus D.C. do have laws to penalize faithless electors, although these have never been enforced (& in lieu of penalizing a faithless elector, some states, such as Michigan & Minnesota (the latter of which invoked this law for the first time in 2016 when an elector pledged to Clinton attempted to vote for Bernie Sanders instead), specify that the faithless elector's vote is void & that a replacement elector will vote for the candidate whom the electors' party supports).
They should have filed lawsuits about this. If for no other reason than to get this cleared up by the courts. I agree it is probably unconstitutional to replace them after they have attempted to vote.
They have filed lawsuits.
In 2004, a Minnesota elector voted for John Ewards (sic) for President. This was discovered when the SOS opened the ballot box and counted the votes.
As a result, a bunch of lawyers, some from the firm of Rube Goldberg & Associates devised a scheme that could cover every contingency.
Every elector has an alternate. If there is no alternate, then the other electors vote on one of the alternates. If there is a tie vote, one is chosen by lot. If there are no alternates left, then the other electors may choose one. If there are no electors left, the SOS appoints one.
The basic concept is: the oath of office includes a pledge to vote for the winner of the popular vote. If they refuse to take the oath, they have vacated the office. After they fill in the sheet of paper, and it is found they wrote another name on it, it is not considered to be a "vote". Only after the SOS has examined it is it considered to be a vote.
The original certificate of ascertainment said that it was subject to change. The official certificate of ascertainment removes any mention of the original elector.