The previous SEO agency had submitted a Robots.txt file requesting search engines not to index any URL containing /index.php/
Many sites require there to be /index.php/ URLs in addition to the clean URLs and it is common to block search engines with Robots.txt
However, in addition to the Robots.txt file, the previous SEO agency had also added canonical tags on every clean URL specifying that the URL with /index.php/ was the preferred version.
Canonical tags are used when a website has 2 identical, or very similar, webpages, which is common with ecommerce sites. The tag tells the search engine which of the 2 pages is the preferred page to show up in search results.
Essentially, the website was telling search engines that they preferred the /index.php/ URLs instead of the clean URLs, but at the same time were telling search engines NOT to index those /index.php/ URLs.