I take 8000 D3 (+200ug K2 MK7) daily and I'm fine. since covid I go like this for entirety of winter and then back down when summer comes. Perhaps you live in a climate where you get a lot of sun exposure and somehow overdosed on that. A guy from vitadmindwiki.com even says that you'd have to take 14000IU daily for a year until reaching toxicity limit (although this guy tends to sometimes say different things on the same topic, so I'd be cautious on whether this is the exact amount)
https://vitamindwiki.com/Overview+Toxicity+of+vitamin+DAlthough it'd be great if you explained what exactly happened, perhaps it wasn't a result of taking vitamin D itself but rather some external thing. Judging by "painful experience" I assume kidney stones, which could be caused by too much calcium or genetic preference. not a doctor or an expert on the topic though, just open for a discussion :)