Sir Keir Starmer should use his announcement on increasing defence spending to try and deter Donald Trump from implementing tariffs, a former civil service chief has suggested.