No, the G-series is about 10% slower. 5600X is only 1-2% faster and it produces more heat, uses a bit more energy.
Where I live cheapest B450 MB costs 70usd, 100usd for cheapest B550, cheapest B660 costs 140usd, 5600X costs 330usd and 12400f costs 220usd so the cheapest 12400F combo is 360usd, while cheapest 5600X combo is 400usd. The stock Intel cooler is superior to wraith stealth though as you lose 2-300MHz allcore speed using wraith due to temp lowering core clocks above 70C.
I own both and summarized:
12400F:
+More efficient
+more bang for bucks
+better stock cooler
+runs cooler
+faster in rendering like CB (5-10%)
5600X:
+better IMC, can usually run memory at 3733-4200 (i5 12400F does 3400-3800 max from what I've read so far) depending on binning
+a bit faster (5-10%) once fully tweaked due to curve optimizer, pbo and faster ram
+faster in zipping