Store bought properly certified ebikes left in their vanilla state seem to be very safe.
I'd agree with that.
There are many scary stories to be found 'out there' and unless you really look into them to find out what the fire's cause was (and that is something not easily found as detail comes second to headline grabing), it is easy to form quite a glum impression of ebike fires.
Ebike kits if bought from a reputable outlet are, I would say as equally safe as store bought ebikes. Kits being more generic in their makeup are more easily 'fiddled with' and badly made DIY battery packs / or stupidly cheap ones can be used on kits which I would suggest are where the problems begin, to say nothing of cheap chargers for said battery packs.
PS there are many people with adequate and suitable knowledge to safely build and use their own battery packs - the pedelec UK website is a useful source of information in this respect. Disclaimer - I have built and used three ebike battery packs all without issue or fuss and I'm not expecting any either.