In this instance "cup of tea" is considered as a single entity, so the adjective precedes the whole of it. Although this is impossible in some languages, it is extremely common in English. cf "a cheap bed and breakfast", "a scary book of stories", etc.