Changing your major is cheaper than spending forty years in the wrong one.
RESILIENCE
RESILIENCE
Sunk cost is running the argument here, and it argues badly. The two years already spent are gone either way, and staying does not recover them, it only adds to the pile. The real comparison is between what switching costs now and what the next several decades cost, and those two numbers are not close to each other.
Get the facts before the feelings. What actually transfers, how much extra time, who has done it already. Talk to somebody doing the work you are considering. Changing course with information is not quitting, whatever it feels like to announce.
What would switching directions cost you compared with staying wrong?
Free, with nothing to buy inside it.