It's actually the reason I left Logic many years ago. I worked with Apple for 6 months on it. They literally did everything they could from upgrading my computer for free, to giving me the latest OS's for free. No one could get rid of the issue. The last time I did it, I ended up full out punching myself right in the face and almost blacked myself out from having headphones on and it doing it.
I will never use Logic again as long as I live from that scare. It's never happened to me again (moved to Windows and Studio One).
Hope you figure it out. Please put some type of hardware protection into your system if you don't have it. They literally happen without warning and without knowing cause. Your hearing is way to important and the fear I had every day working in Logic took away some of my creative power.
I wish you the best figuring this out!