Find shortest prefix to generate original string by overlapping
You are asking about "quasiperiodicity".   This is a well-studied topic and a google scholar search will turn up many papers about it.  For example, there is an $O(n (\log n)^2)$ algorithm
here and an $O(n \log n)$ algorithm here.