As it happened, the competence and destructiveness of the Japanese attack on Pearl Harbor were unexpected. Until then, the Japanese were thought to be almost comically incapable as soldiers and that such a feat was far beyond them. Roosevelt and his advisers seem to have calculated that the Japanese attack would be repulsed with heavy losses to the attackers, making for a great US defensive victory. It would also provide the basis for entry into the war against Germany based on their expected declaration of war once Pearl Harbor was attacked.
It is worth noting that the Japanese very much learned from the British, who took out the Italian fleet at Taranto harbor in 1940 in a sneak attack. With Fairey Swordfish! (Look it up).
That the US Navy got taken out in a highly similar attack a year later did NOT reflect well on the Navy.