Kaley Cuoco learned not to ‘take [herself] seriously’ after working with John Ritter