Add isolation to a switching power supply
Given your application, you need ~5-10W of isolated 12V power from a 24V source. There are two common options available:


Use an off the shelf 1:1 isolation DC/DC supply. You could go from 24V to 24V, and buck etc. afterwards. As for price, they run 10-20 USD. Here is one that exactly works for you, even allows 18-75V input and outputs 24V 6W for 10USD. 1866-4815-ND
Flyback supplies (DCM or CCM) are the ideal supply for this option. If this is a 1 off project, it could be a good learning experience, but it will be more work vs using an off the shelf module like #1. There are plenty of cheap IC chips, and for your 24:12V you can buy an off the shelf 1:1 or 2:1 transformer. Here is a 1.5USD IC that has built in transistor etc. CS5173GDR8GOSCT-ND


Goodluck! Use Digikey next time.