As a Birmingham area resident and fairly frequent user of the Wolverhampton to BNS line can I just make a comment based on experience.
The service is frequently subjected to delays during peak periods due to lack of capacity (only 2 tracks). However, most services have quite a bit of recovery time built in to the timetable and it is not uncommon to sit impatiently in Wolves, or inside the BNS tunnel, for sometime and still arrive on time or even a minute or two early.
Two things mitigate in the OP favour. Namely this service is allowed 24 mins from Wolves to BNS, at the dead of night, and could easily cover the ground in 15mins with a clear road. The Rugby service is booked off platform 4A. I can't find a platform booked for the Glasgow arrival but, as I assume its a voyager, it could well be 4B or 5A/B Even 2/3 or 5/6 would only require around 3mins for a determined and agile person - I often manage to make an 11 min connection walking from BNS to Moor Street although, at 77y.o., I do get a bit puffed these days.
All that said, for the sake of 40 mins,the 18.00 off Glasgow Central has a booked connection at Wolverhampton (arr 21.31) into the 21.45 Pendolino (Rugby arr 22.41) and with both using Platform 3 theres no problem changing platforms. I would be inclined to play safe and use this if an 1800 departure can be achieved
Dave