After some time I gave up and cheated using Wolfram Alpha and got the result $4076363$.
I played around with the general statement
What is the remainder when $x^x-x$ is divided by $x^2+x+1$ where $x$ is an integer.
I noticed that when $x$ is a multiple if $3$ the remainder is $x^2+2$. As $ 2019$ is a multiple of $3$, we can test $x=2019$ surprisingly I got the correct answer.
Let $x=3k$. After some modular arithmetic manipulation, this all boils down to proving
$(3k)^{3k} \cong 1 (mod 9k^2+3k+1)$ where $k = 0,1,2...$
Again after playing around I noticed that $ 3k|\phi(9k^2+3k+1)$. I don't know whether this would be helpful in proving. How can I progress from here? Please try to post an elementary solution as I am just a high school student.
