I have been having issues with my 9-speed rear derailleur and was hoping somebody could help shine some light on it. Thanks in advance! I can adjust my rear cable tension such that either the few top gears or few low gears will shift appropriately, but not both. 

If I tighten the cable, the shifting for gears 1-2-3 is very smooth - but then trying to shift to 4-5-6-7 it gets a bit more sluggish and then 8-9 barely work at all (i.e. if the shifter is set to 8 it will stay in 7, and if the shifter is set to 9 it will stay in 8).

Conversely, if the cable is loose the bike shifts well in gears 1-2-3-4, but then it is very sluggish for 5-8, and when the bike is in 9 the chain is constantly trying to "jump" into 8th.

What I've done:
-The lower limit screw is set such that when the cable is disconnected the bike pedals in 1 smoothly
-The upper limit screw is set such that when I push the derailleur inward the bike pedals on 9 smoothly and I am unable to force the chain into the spokes
- I've replaced the derailleur hanger (as I read this is a common issue when a few gears present shifting issues)
- I've adjusted the B-tension screw such that the derailleur cog is 5 mm from the biggest cassette cog when in 1st gear

I'm wondering if the "range" over which the derailleur is moving left-right is slightly smaller than the cassette's width and therefore by tightening the cable I can force it to match the low gears fairly well, and vice versa for the high gears. I've googled pretty extensively and haven't found anybody else describing this issue unless they are trying to match shifters, derailleurs, and cassettes with different gear counts, which I am not.

If it's helpful: I recently converted by bike to a 1x9 using Shimano Alivio 9 speed shifter, Shimano Alivio Shadow 9 speed rear derailleur, Sunrace 11-40T 9 Speed Cassette and a JGbike derailleur hanger extender (the derailleur cog was running up against the biggest cassette cog)