We are definitely saying the same thing in very different ways.
Just using the drag polar approach and neglecting second-order effects (assume negligible dependence on Re, sufficiently subsonic so negligible impact of M, and linear lift coefficient region aka no stall), we get the following (I'm skipping a lot of intermediary steps):
Cd = Cd0 + k*Cl^2
-> Cd0 is the parasitic drag coefficient
-> k is the lift-induced drag coefficient
-> Cd is the overall drag coefficient
Range is maximized when Cd0 = k*Cl^2 (parasitic drag = lift-induced drag)
-> Cl is a function of speed: since the required lift is constant, more speed = less Cl required = less lift-induced drag
-> maximum L/D is achieved at this range-optimal speed
This speed can be calculated exactly from the total weight (W), air density (rho), lifting area (S), and drag coefficients:
range-optimal speed = sqrt((2*W/(rho*S))*sqrt(k/Cd0))
As long as you always operate at this range-optimal speed (aka speed for maximum L/D) which is a function of air density (and therefore altitude), the equation for range reduces significantly:
R = endurance*velocity, where endurance = battery energy / drag power, and we know the equation for drag power...
Simplifies to:
R = E*eta/(2*sqrt(Cd0*k)*W)
-> R is range
-> E is battery energy
-> eta is total system efficiency
Dimensionally, this equation is of course the same as yours, with an energy being divided by a force to get a distance. The key point I am trying to make is that if you just look at that equation with no context, speed and air density are not present anywhere. But what is hidden in the assumptions is that you are assuming that you are operating at the maximum L/D speed given the air density at any particular altitude. Going back to my other comment, range at the range-optimal speed does not depend on air density or velocity directly, but lower air density at higher altitudes will result in a higher range-optimal speed, and hence less travel time for a given range.