The legal basis of a caretaker government has to be argued in light of the nature of a government in a parliamentary system like ours. Of course, given its role and function, there is room to argue that a caretaker government is not something that is absolutely necessary. For one thing it is just for a short period and that it merely carries out routine administration.
This is plausible given that the civil service – which includes the armed forces and the police force – are still around. Indeed, the system which includes the judiciary – except the government of the day – still exists and is operational. On top of that, the ultimate guardian of the constitution – the Yang di Pertuan Agong - is still there symbolising the nation.