Normally it shouldn't act like that. The internal mic should disable automatically when ever line in is plugged with right type of connecter.
The only reason that your iMac didn't disable internal mic because you use 1/8" TS to 1/4" TS adapter. The 1/8" TRS input jack of your iMac didn't detect all three-conductors (Which are Tip Ring and Sleeve) that's why it didn't tell your machine to turn off internal Mic.
You'll have to get Y-cable that split from 1/8" Stereo TRS to 2 mono 1/4" TS Jacks. It looks like this.
Be careful don't buy headphone splitter. They look very similar to each other.
Or 1/8" TRS to 1/4" TS Cables like this is OK to use too. This is
'Monster iStudioLink Instrument Cable' cost around $26
Y-cable or Instrument Cable can be DIY but you should use high standard cables and connecters such as Canare, Mogami, belden, Neutrik, and etc... It's a lot better than cheap pre-assembled cables and cheaper than expensive cables such as belkin, monster and etc...
I've been using Canare cables with neutrik connecters in my studio for more than 10 years and all my cables still working fine.
btw after you've solved Feedback issue with these cables you might get another issue because plugging in Hi-Z guitar's output in to Lo-Z computer's input might cause 'Impedance mismatch'.
Impedance mismatch can be acceptable to some people, So you might be OK with it. But If you'd like to get better matched signal you may consider to buy mic preamp or audio interface that have mic preamp at later time. (most of them have instrument inputs as well. So you can record both mic and instrument. Well... I think it's good investment though.)
cheapest mic preamp that I can think of is 'SM Pro Audio XPM1 Single Mic Preamp' $49.99
or Audio interface like this one 'Focusrite Saffire 6 USB' $199.99