The Rama (Y.D. 178) cites the Maharik and Ran who hold that the prohibition of chukos ha'akum only applies to customs that they have which border on pritzus, or customs that they have which are totally irrational. The reason for the prohibition is that although we don't clearly see a connection to idolatry, we are obligated to be concerned that customs that they have which cannot be explained rationally are sourced in idolatry. Even if they themselves don't realize the connection to idolatry, the custom in earlier generations may have a some connection to idolatry and is therefore prohibited. But, any customs that are rational and have a reason that is understandable, even if we are learning the behavior from the goyim, it is permitted. Based on this the Rama allows for physicians to wear uniforms which is a style of dress adapted from the goyim, but since it has a purpose of creating an feeling of respect and honor, it is permitted. With this approach, the Rama explains the heter to burn the items of a king - it is done for the honor of the king. Since it is for a rational and legitimate reason, it doesn't violate דרכי האמורי.
The approach of the Rama and leniency to allow any custom which has a legitimate reason is based on the sugya in Avoda Zara which seems to say that since burning shows the chashivus of kings, it is not considered darchei ha'emori, but completely ignores the sugya in Sanhedrin 52b which permits only things that are sourced in the Torah. Tosafos raises the contradiction between the two sugyos and concludes: There are 2 types of darchei ha'emori - 1. Things that are connected to Avoda Zara which are assur under all circumstances. 2. Things which are not connected to Avoda Zara but are considered silly customs unless we can find a legitimate source for them in our own literature - כתיבא באורייתא. The gemara in Avoda Zara originally thinks that burning the items of kings is an avoda zara related issue, and concludes that it is only "chashivusa", and not avoda zara related. This still isn't sufficient to permit it since it would just be a mundane custom that is learned from the goyim. Therefore, the gemara in Sanhedrin explains that it is written in the Torah, meaning that it is not something that we learn from them and therefore is permitted. The Gr"a (178:7) is machmir for the approach of Tosafos and therefore holds that we cannot permit anything that has a good rationale because if it is learned from the goyim it would still be darchei ha'emori. We can only permit it if: 1. it isn't connected to avoda zara. 2. it is not learned from the goyim, rather it is mentioned in the Torah or something that we would do anyway. Based on this approach, any uniform that is worn for a good reason but we adapted it from the goyim would be a problem of darchei ha'emori. It is only permitted if our wearing of it isn't taken from the goyim.