I mean, put yourself into the hypothetical supreme naval planner of, say, the US or Japan at the time. Are you really going to gamble your entire nations (or empires, if you will) capability to project force overseas on the notion that air power is the future and battleships are obsolete? If you're wrong, the enemy battleship fleet will just shrug off your feeble aerial attacks and proceed to crush your navy and conquer your overseas assets.
So in that sense it's no surprise that both USN and IJN built both battleships and carriers. And at least the US kept building them long after Pearl Harbor (though the Iowas were all ordered before Pearl Harbor, but they weren't cancelled in favor of carriers or converted into such either).