The Japanese Navy had a pretty powerful fleet with a strong carrier group and numerous battleships. Even if the Japanese had not attacked with aircraft could only two capital ships have had any realistic hope of holding off a determined thrust by Japanese surface combatants? Should not Singapore have been given more naval resources?
Force Z represents an almost text book example of the application of the "Fleet in Being" principle.
By having a few powerful units, in order to defeat them the IJN would have to dedicate a much larger number of assets in order to be assured of success, and because they had a limited number of capital ships that they would thus be tied down and unable to accomplish other missions or be in strength elsewhere.
However that was the mostly political reasoning, it also flies in the face of the overriding principles all the navies operated on at the time, drawn from Mahan, that of concentration of the fleet.
But in general the goal was to force the IJN to use heavy ships to cover any nearby landings, or leave them vulnerable, and if they were protected in Malaysia they would be vulnerable elsewhere, such as in the Philippines to allow the sizable US garrison to counter those landings.
While in port it was hoped the ships would be safe, with the heavy mining and shore batteries, and land based air support(though it was mostly outdated or inefficient designs). While in order to protect landings or keep a blockade the IJN would need more heavy ships than they were facing. And for a navy with just 10 Battleships in operation at the start of the war that was a large commitment, as 3 or more, or with a good number of their CA's would have been tied own.
They RN, just as the USN was still, despite Taranto not in the habit of thinking of carriers as anything but individual ships. And thinking of their power projection in those terms, finding them lacking when it came to try to take on an escorted and prepared ship at sea, with the attacks on Bismark not doing much to disprove that assumption.
The West in general also took a very dim and unappreciative view of Japanese aviation in the lead up to war, not believing it to be any serious threat. This would of course be proven wrong quickly, in particular the designs typical very good range. Which did much to change the dynamic of the Malaysian campaign. Few Western land based medium bombers would have had the range to attack Force Z, but the Betty was almost incredible in that regard. It was also at least planned to send a carrier to the Far East to add cover farther out at sea to the fleet, however Indomitable ran aground in the Caribbean and thus was delayed, and Hermes was considered too slow to keep up ad would have sacrificed the speed which was part of Force Z's ability it was thought to defend itself in open ocean (Hermes would eventually be caught trying to run and sunk during the Indian Ocean Raid in Spring 1942).
And finally it is worth examining Singapore's place in the defense of the Empire and the situation in late 1941. There were simply much more immediate threats to the UK that the RN had to face. The KM still had their 3 capital ships a day's sail away that had to be countered, and in the Med the large and modern Italian Navy had to be fought to protect the lanes to Malta and Egypt.
While much like War Plan Orange for the US, the Singapore Strategy in large part prescribed that the large part of the fleet would only be sent and rallied to relieve Singapore AFTER it was attacked, not before in deterrence. The fleet was simply too important and other missions too vital to have so much of ti kept so far away.
So long as the garrison was strong enough to hold out that was what was key, and the British command thought it was precisely that, with large numbers if old aircraft, large if a grab bag, or troops, and heavy shore batteries, and now a few heavy units to contest any unprotected landings if they happened, but which would also tie limited IJN heavy units down instead.