Will a 500mA fuse after the 12-to-5V linear voltage regulator make the design safe against electric shock since the buck converter is non-isolated?
No. A fuse does not protect against electric shock. Fuses are for limiting current in a fault condition to protect equipment, wiring and prevent fire. What you are proposing is potentially lethal. You must isolate the low voltage circuit from mains if there is any risk of contact with the circuit.
Just for reference, RCD / GFCI earth leakage protection devices generally trip at 30 mA as this is considered a safe limit for protection of humans against electric shock.
Put safety first. Then worry about size and cost. An isolatedisolated SMPS (switched mode power supply) with 5 V output won't be any bigger than what you are proposing.