re
The result was a successful attack on a shallow-water Naval port that was unprecedented in history, so maybe they get a sort of "pass" for not expecting an attack?
??
Taranto Harbor was attacked on 11 November 1940. The RN used similar methods to those used by the Japanese later at Pearl Harbor - except the RN attacked at night with far fewer aircraft and focused on the Italian fleet almost exclusively.
Pearl Harbor was attacked on 7 December 1941. Historical records - including post-war intel - show that Japan had taken notice of the RN attack on Taranto, and that the RNs performance influenced their decision to attack the US Fleet in Pearl.
Taranto Harbor majority depth was ~40 ft.
Pearl Harbor majority depth was ~45 ft.
Incidentally, various parties in the USN also took notice of the RN's success at Taranto. Their analysis of the Pearl Harbor arrangements (conducted in early-1941 - after the attack on Taranto) indicated that a similar attack in Pearl Harbor was possible.
re causes of Pearl Harbor and some of the other stuff
The US post-war analysis of the events at the start of WWII concluded that a lack of any USN or US Army commanders with recent experience remotely resembling serious naval or land warfare was the main contributing factor to the poor performance of US forces in the early stages of the war. This included the commanders at Pearl Harbor and in the Philippines, as well as in other theaters. This assessment was held to be true at least through the Tunisia campaign.
MacArthur, Kimmel, and Short, all followed the official doctrine (at the time) in their initial preparations for war - and this included things like arranging the aircraft to prevent sabotage. While their lack of imagination - and consequent inability to predict what shape the war would take in its opening stages - can be held as a fault, there is no rational reason to think that anyone else would have done better. The lack of experience was just too great. This phenomena is apparent in the progression of the war in Europe as well.
The participants in the decades long planning of War Plan Orange had concluded by ~1935 that the Philippines could not be held against a serious Japanese attack and that any practical reinforcing of the islands would make no difference - the supply lines and reaction times were just too long, and the materiel and personnel needed to drag out the invasion to a useful timeline (until reinforcement and relief) would only result in inevitable and unacceptable losses. Abandoning the PI became a part of the plan. Unfortunately for MacArthur, the planners did not inform him of this decision (his position did not allow him access to the actual plans) until after the war started. MacArthur wanted to defend the PI and continuously requested more war materiel needed to do so, along with permissions to raise and train more PI native personnel - but he was denied said materiel and permissions (partly due to politics in the US and partly due to the effects of the Great Depression) until shortly before the war started. There was subsequently not enough time to implement the hoped for plans. He was subsequently ordered to leave due to the fear by Washington that his capture would be too much of a propaganda asset to Japan. MacArthur felt that the US had betrayed the PI peoples.
NOTE that the progression in developments for defending the PI (or lack thereof) followed a very similar path as the problems with developing Singapore by the British - the distances were too great, and cost and/or politics intervened.
NOTE also that every major Allied combatant had similar problems with reacting effectively during the early stage of the war when attacked by the Germans and Japanese. There is a reason for this.