ISIS has dozens of fathers. And John McCain is definitely one of them. In the 2012 and 2013, he was one of the masterminds in channeling the money and weaponry to various rebel groups (through the Saudis and the Qataris) in Syria. These rebel groups later transformed themselves in to the Islamic State. The money / weapon flow continued even after the Islamic State started massacring the religious minorities and the Shiites.
That's the consequence of trying to put order to chaos in a region of the world that is lead and ruled by tribes rather than governments. There's no loyalty and there's no predicting who will align with who in year to come. McCain was doing something in 2012 that at the time had likely zero implication what could have happened. Hell, he could have been getting played by these tribal leaders (most likely!)
What the US needs to do is let the people in the Middle East figure their shit out on their own for a while...remove the money...remove the forces...just keep a close watch and make sure the fighting doesn't venture outside of their backyard.