Completely constitutional. The constitution says state legislature can choose and instruct their elector college voters however they want. Doesn’t have to involve voting at all, they can directly assign, they can draw lots, or they can pin it on the results of the national election.
I hate the idea. But I think you're right. The Constitution gives the states have great latitude in how they assign their electoral votes.
So folks need to take this threat seriously.
From all the posts I have been reading of Hamilton's writings on the Electoral College, I get the impression that the original intent was for the states to merely select electors, and that the electors would elect the president.