The interaction between evolution and learning called the Baldwin effect is a two-step evolutionary scenario caused by the balances between benefit and cost of learning in general. However, little is known about the dynamic evolution of these balances in complex environments. Our purpose is to give a new insight into the benefit and cost of learning by focusing on the quantitative evolution of phenotypic plasticity under the assumption of epistatic interactions. For this purpose, we have constructed an evolutionary model of quantitative traits by using an extended version of Kauffman's NK fitness landscape. Phenotypic plasticity is introduced into our model; whether each phenotype is plastic or not is genetically defined, and plastic phenotypes can be adjusted by learning. The simulation results clearly show that drastic changes in roles of learning cause three-step evolution through the Baldwin effect and also cause the evolution of genetic robustness against mutations. We also conceptualize four different roles of learning by using a hill-climbing image of a population on a fitness landscape.