Understanding substrate plasticity and buckling of thin films