Misaligned new derailleur? I just installed a new Alivio M4000 rear derailleur to replace a Tiagra derailleur on 1X-converted road bike. It looks wildly misaligned to me and shifts terribly. 

The hanger is perfectly aligned. The first link of the derailleur seems aligned, but the second link doesn't, and cage seems skewed even further.  



Does this look defective? Or have I installed it poorly?
Definitely something very wrong there.

The derailleur cage appears twisted around a vertical axis (the 'front' of the cage seems to be pointing outwards). A bent derailleur hanger typically rotates the cage around a horizontal axis (kicks the lower jockey wheel inwards). That makes me think the derailleur is bent rather than the derailleur hanger.

Do you have the old derailleur? Install that and see if the cage is parallel with the chainrings by looking down he chain-stay as in your first picture. If the old derailleur cage is parallel, the new derailleur is damaged.