Text this: Pattern avoidance in compositions and powers of permutations