5v = 1024, yes, but you cannot measure 5V with 5V reference, the maximum value you can measure is 1023/1024 of Vref, i.e. if Vref=5V, then max value is 4.995V. This and all voltages above this will read as 1023 (0x3FF).
So, you're right, the Vref voltage requires value 1024 which requires 11 bits to store, but you never can measure that voltage using ADC.
But according to the datasheet (28.9 ADC Characteristics at page 265) Absolute accuracy of the ADC in ATmega328P is typically at 2.2 LSB, so you can be not worried about 1LSB error which appears if use 1023 instead of 1024 as the divisor.
But still, using of 1024 not only more correct in meaning of measurement, but also can be optimized in integer math, thus not requiring complex operations such as the division:
// convert ADC value into millivolts (assuming Vref is 5000 mV)
uint16_t result_in_mv = ((uint32_t)adc_result * 5000UL) >> 10;