to paint oneself into a corner is the idiomatic expression.
To paint [x] into a corner is also an idiomatic expression.
BUT: They painted us into a corner. That works too.
He painted me into a corner. Just two examples.
From that we get:
They painted themselves into a corner.
He painted himself into a corner.
She painted herself into a corner.
I painted myself into a corner.
We painted ourselves into a corner.
You painted yourself into a corner.
Just follow the idiom.
Also: others can paint you into a corner:
Should Republicans actually try to paint Democrats into a corner
with a rapid repeal, Reid painted a bleak picture of the ensuing
damage. The Huffington Post
He was obviously more focused on creating a framework that's open to
certain precedent — an album like Herbie Hancock's "Prisoner" comes to
mind — but doesn't feel painted into a corner. The New York Times
Brian Bacchus, who produced "Liquid Spirit" and has also collaborated
with Norah Jones and Cassandra Wilson, described this expansive work
as a response to "the jazz singer having been painted into a corner in
terms of the repertoire," much of which is now considerably older than
many of its interpreters. The Los Angeles Times
paint into a corner from Ludwig.guru
Warning that the prime minister’s actions since the election have
painted him into a corner as his self-imposed 31 December deadline for
a deal grows nearer, the ex-minister said: “The question really is
whether Boris prefers to wreck the economy by going along with his
backbenchers and going for no deal – or the Australia option as he’s
now calling it – with all the disruption to trade and price hikes and
business closures and job losses that would mean, not to mention going
down in history as the Tory PM who broke up the union.
The Independent_UK
Second, this book will help young women see the importance of
partnering with their parents in the courtship process. I believe most
young women want their parents involved in this. Of course, the
culture has painted them into a corner, and they don’t quite know how
to get out.
Book_UK
And from The Economist via Ludwig.guru, also:
And it is true that India's finance ministers have been painted into
a corner by their predecessors because of the cost of financing the
deficit.
The Economist has the best English in the entire world...