Taiwan’s top court delivers boost to president as he seeks to strengthen defences against China