How to apply a patch via plugin?

I need to apply this patch. A traditional way is to SSH to my hosting and use the Unix command patch < path_to_patch. However, this will be lost after a new update. So it seems that the long-term way is to do this via plugin. Is there a way to do this