Severe dandruff could indicate dandruff itself which is significant or can indicate beginning of some other skin condition like Seborrheic dermatitis or Scalp psoriasis. Based on your description of pain on the scalp it looks like a superficial bacterial infection usually caused by staphylococcus aureus. Sometimes they co-exist with fungal folliculitis and can be determined with more precision during a consultation.
Next Steps
Kindly consult a dermatologist for exact diagnosis and treatment plan.
Health Tips
It is also important to prevent their relapse once you have got it cured. A decolonization regimen suggested by your doctor will help.