@choster rightly says that "the purpose of the headline is to attract readers and encourage them to read the article itself".
Even in pre-clickbait days, the purpose of a headline was primarily to entice people to read the story. Headlines are written in headlinese (and British headlinese is sometimes different in style from American, so the views of native BrE speakers are possibly more valuable here).
Features of headlinese vary but can include noun piles, omission of determiners, omission of auxiliaries, and other slightly unnatural wordings.
In headlinese, the simple present tends to stand in for the present perfect. So "France declares war" would mean "France has declared war"; "Trump announces new executive order" would mean "Trump has announced a new executive order".
Hence, "12-year-old boy who transitioned to female changes his mind just two years later" can be interpreted as "A 12-year-old boy who had transitioned to female has changed his mind just two years later". This doesn't seem to solve the problem of ambiguity, though. If anything, the literal interpretation would seem to be that he is 12 now.
For what it's worth, my assumption was that the boy was 12 when he transitioned - and this turned out to be correct. I agree with you that it seems ambiguous, but I can't say for sure whether I would have thought about the ambiguity if I had seen the headline in the wild, rather than being preconditioned by your post to see ambiguity there. If other native-speaker readers had the same interpretation as me, the question arises as to whether that's based on our parsing of the headline or whether it is just a pragmatic assumption that transitioning at the age of 10 is relatively rare and therefore less likely.