You are right. I thought since I bought this at AC website, I would get SQM for all segments but given the fare rule, it seems like I would get nothing form XQ (Sunexpress) flight. In the past, I got miles from an XQ flight one time -possibly it was marketed as Lufthansa as you said--but got nothing another time.
There have been times in the past when LH wet-leased capacity from SunExpress. They were operating some intra-Europe flights for LH in 2019 when they were short of capacity due to 320neo delivery delays or something - I flew SunExpress metal FCO-FRA, marketed as LH231, for example.
Now I will be short of 700 miles to be an Elite. No Aeroplan credit card spendings give SQM, right? If not, I have to do a short mileage run
Please see
this thread.