MacBook Pro kernel panic after speaker change
To solve this problem, I needed to find out a way to install drivers one by one to see what causes the display to flicker and OS to crash. I did not a find an easy way to do this in Mac OS. So I installed Windows 10 on MacBook Pro without using Bootcamp. I downloaded Bootcamp support software from Apple website. I did not install all drivers from this support software at once. Instead, I installed drivers one by one and verified if it is causing any problem. After hours of investigation, I found out that as soon as Intel Iris Device Driver is installed operating system crashes. To get MacBook working again, I had to find a way in which I could force operating system from loading these device drivers. Even if I do not install these drivers manually, windows would download drivers and install it for me. To make sure windows do not download these drivers, I did three things.

First, I made sure windows will not install drivers for the faulty hardware. 
Second, I disabled automatic driver download and install.
Third, I changed my wifi connection to metered.

Now everything is working. But I am using Windows 10 instead of MacOS. Windows 10 saved me from replacing logic board on my MacBook Pro. Windows 10 supports bash, so I feel at home.