Folklorists sometimes treat the association between St John the Baptist and the Summer Solstice as no more than an accident, an attempted Christianisation of pagan rites. I'm not convinced it's that simple
Midsummer is the pivot of the year, just as John the Baptist is the pivotal figure of the Christian Bible: the last prophet, and an 'Old Testament' figure who helps inaugurate the New Testament by baptising Jesus. So placing John's birth at Midsummer makes a lot of sense
In many countries, Midsummer has strong associations with water; spontaneous naked bathing at Midsummer is often regarded as characteristically pagan. But in light of the date, could this be an expression of Christian popular religion, a reminder of baptism?
In the same way, the association of Midsummer with foretelling the future seems distinctly appropriate for the feast of a great prophet. Similarly, the appearance of a dragon in Midsummer rites may might reference triumph over the devil in baptism
As I wrote in this article a while ago in @firstthingsmag, much of what we casually assume was 'pagan' in medieval culture was actually Christian popular religion https://www.firstthings.com/article/2020/02/the-myth-of-medieval-paganism
Just because it doesn't conform to what we think Christianity should be, doesn't mean it isn't a manifestation of Christian culture. Stop, look and listen before plunging into dubious speculation about the pagan origins of folkloric practices
And something else very important I forgot to mention: the association between Midsummer and fertility is also directly to do with St John the Baptist, since he was a son of a woman thought barren. It doesn't have to pagan just because it's to do with fertility...