sometimes it is valid to put custom SPs in master or msdb.
suppose you want an sp to be globally accessible? put it in master, prefix it sp_ all set. yes u need to take this into account in DR scenario, but this is not a big deal. SPs to do Backups, Greps, or send SMTP mail are good candidates for the master database. Also, can mark the object as system as well.
How about an SP to return job execution status and history? There is nothing wrong with putting that in msdb.
i do agree that i will avoid restoring master if possible -- often rather just restore user DBs and msdb to a new instance, so keeping the scripts available is important. and yes, having your own administrative db should be a must for DBAs
Putting user objects of any type in system databases should not be done without careful consideration, but there are certainly valid scenarios in which doing so is a good idea.
NOW -- the script for the trace the OP is asking for...if it's too big for a job, my recommendation is to put it in a file and execute with SQLCMD.