The engine flush you buy in the parts shop is made from petroleum distillates with a few additives such as zinc so technically it is more or less just a lighter oil.
More specifically, it's mainly paraffin aka kerosene, so if you change your own oil and want to save some money, just use paraffin. Throw in 500ml, let the engine run for 10-15 minutes and drain when still warm.
Seafoam is a mix of pale oil, naphthalene and isopropyl alcohol. So in theory you can mix paraffin with a bit of IPA and hey presto, DIY Seafoam.