Trump's ego seems to be in a permanent state of competition with anyone and anything existing outside of the hallowed, adoring circle of his supporters and backers who have created an alternative world - a Trump world - for him.
Apart from the lack of self-awareness that allows him to post the AI generated image on Truth Social, and the inability to understand the finer points of social and cultural etiquette which appear to be part of his trademark - I wonder if it was the case that he felt the late Pope Francis was getting too much attention from too many quarters, so he had to muscle-in on it. A bit like a precocious child who momentarily, losing the attention of its adoring family, does something outrageous to re-focus it back on him.