Hello young0
Working as a train conductor on this line I can tell you, this change is realistic and an official connection; it’s done by many people. Simply be prepared for the arrival and get off the train in Lugano quickly. Watch out for the indications on the train to Milan, to board the right part of it.
The train to Milan is usually waiting if the IC/EC is late by 2-3 minutes.
If you miss the train because the previous one was late you can take the next connection at no additional charge. If you miss it because the change took you too long, you might have to buy a new ticket; this depends on the type of ticket you got.
Best regards,
Roland