For some of these examples I think you're already paying several penalties. As such the demotion costs could be rolled into increasing the attached costs if need be. Otherwise the added demotion costs are pretty hard to predict for new players who wreck their economies the first game or two (I know I did when 2.2 first hit). For more experienced players it just gives them an unfair advantage over the AI which doesn't understand or use the systems. Demotion examples:
1. Replace a consumer goods factory with 8 jobs with a research lab with 8 jobs.
You lose the investment in the goods factory = 400 + 600 + 800 = 1800 minerals lost and 50 + 100 = 150 crystals
and then pay the lab costs as normal.
You also have the output of 6 fewer specialists, so 6 unemployed/demoting pops for many years even if you have open worker jobs. (480 + 480 days assuming you upgrade to the same level and don't wait for demotion to complete).
Your planet is also busy for a long time (lab+upgrade+upgrade, 360 + 480 + 480 using the wiki values... which seem a bit high to me)
Demotion makes that up to 8 fewer specialists (if intelligent workers are promoted instead) who are all (potentially) now unemployed instead of workers. It adds a large monthly cost in terms of output (they aren't working), stability (they're less happy, more political power than workers), crime etc on top of the large loss in investment in terms of upfront mineral and rare resource costs.
2. For switching civics you already pay a large cost in influence - more if you first promote or embrace a faction to be able to switch civics, less if the change is more minor.
Demotion (sometimes) adds a huge monthly cost for the next 15 years that you can't predict or calculate before hand, with no warnings that you'll have to pay this extra cost.
3. For putting the best pops on each job you again have to pay a cost - genetic modification, migration treaties, conquest, buying from the galactic market etc.
Demotion adds both an extra fee (15 years for your newly improved rulers to kick the old rulers down to workers) as well as some game-mechanics that stop pops from doing the correct jobs in the first place (making genetic modification, migration, conquest and the slave market all a bit broken) because it would cause the above effect when the new pops do the job they're best at. So pop traits don't really matter unless every pop on a planet has that trait because the game will not give them the correct job. Obviously that's hyperbole, traits do matter... just far less than the values indicate as they will rarely be doing the jobs they're good at.
If egalitarians are to be given a buff in this respect then perhaps give them (one of) the following:
A resource refund when replacing buildings,
A discount reforming government,
A happiness boost when pops work their idea job (tied to living standards)
You'd achieve the same things, but without having a large, opaque and confusing penalty to new players that also blocks the job mechanic from working properly.
Or if you really want to keep it in... make it a proper mechanic that you interact with regularly and not merely when you make a mistake, or when the game makes a mistake. Training times and costs for ALL new jobs, modified by civics, traits, techs etc. But if you do that, please make sure it's fun and adds something to the game first. Personally I think what it adds to the roleplay, (e.g. rising unrest when changing from aristocrats to a technocracy) isn't worth the added frustration for new players. You could achieve more interesting and thematic situations with events that trigger on changing civics as well as more options for player interaction and different outcomes. In short, I don't think demotion is needed or a good thing in the game.