Would it be weird/unrealistic if an intellectually disabled character wasn't diagnosed until the age of 12? I know he would probably struggle in school even before then, but then again maybe his parents and teachers realize that he's behind his peers but don't realize the extent of the issue yet.
That's absolutely possible if he's mildly affected. It could be due to;
1) assuming it's autism or another developmental disability (that's not ID) like that,
2) assuming it's the inability to see or hear to some degree rather than the inability to properly comprehend what they see or hear (also happens the other way around),
3) assuming it's just being behind in a regular non disabled way, or
4) knowing "something" is up but simply not having the resources or knowledge to realize what exactly that is.
4) is extremely common because ID is more likely to occur in developing countries due to things like malnutrition, lack of access to vaccination and OBGYN care, etc., where it might also be hard to impossible to get an actual diagnosis, especially if you're in a rural area.
I was only formally diagnosed in elementary school despite having had documented signs of developmental disability roughly since I was born. So it happens. Sometimes you have to wait for the delay to show more to be able to say "ok, that's probably not just autism with a coordination disorder".
Being intellectually disabled and not being intellectually disabled is also a spectrum, not a 1:0 situation. In many places you'd get an IQ test (not an endorsement of it, I'm just saying what's used, including what was used for me) and 70/69 points will get you "mild". But it's not like a person who gets a score of 71 has completely different problems than someone who scored 70, despite only one of them possibly getting a diagnosis. I've read that around 13% of people who don't qualify for a diagnosis (anymore) still have problems related to intellectual functioning.
TLDR; unless your character has a very obvious* visible cause (like a major skull condition** or down syndrome), he absolutely could've gone recognized as just "somewhat behind, but not actually disabled".
* - as always, keep in mind your setting and their family's knowledge when thinking what would be considered "obvious" .
** - I have a very mild one and it was only considered relevant afterwards lmao
If he has profound or severe ID, it's possible that he wouldn't have had a formal diagnosis, but he would've had an informal one for a long time because it would've been very clear way before he was 12.