President Donald Trump’s administration has dramatically expanded its work with Palantir, elevating the company cofounded by Trump ally Peter Thiel as the government’s go-to software developer.