STM32 - AHB Prescaler disabling Systick
The meaning of the parameter you pass to HAL_SYSTICK_Config is the number of ticks before a SYSTICK interrupt is generated. So in the example code, the SYSCLK is the HSI with 8 MHz. And the HCLK has no prescaler, so HCLK is also 8 MHz.

A SYSTICK interrupt will be generated every 8 000 000 / 8 000 = 1 000 ticks, because the SYSTICK clock has an own prescaler of 8 based on HCLK, the actual SYSTICK frequency will be 1 MHz. 1 000 ticks turns into a SYSTICK interrupt of 1 ms.

So if you set your HCLK to be 2 MHz, it will set it to 250 ticks, resulting in still 1 ms interrupts. So you don't have to change that value with changing prescaler.

I currently don't see a reason why this won't work. Maybe you can go into debug and see what the result of HAL_RCC_GetHCLKFreq() is when you have a divider in place. Maybe divide that line into two like to make it easier to debug:

uint32_t hclk = HAL_RCC_GetHCLKFreq();
HAL_SYSTICK_Config(hclk/8000);




RANT

Ugh this is a mess as always with STM32. One of the reasons I'm not using the ST HAL or Cube is the quality of documentation, it's already bad in the reference manual, but worse when you try to understand the API (for example will it return the frequency in Hz, kHz or MHz? nowhere to be found (it is Hz)).