Frequent freezing and random reboots in iMac (2015) running Mojave
My friend, I noticed something similar with my iMac 14,2 made in 2013.   My iMac began to do kernel panics or reboot, denying me use of my machine.

I narrowed the problem down to the wireless, there appears to be a potentially exploitable bug involved, and the solution I have used for some years now is to simply turn off the wireless interface in network systems preferences.  This has afforded my the ability to use my machine without problems.

F.