My Pi (4) is built into a case in the back of my ender 3 and powered by a small buck converter powered by the printer. It's connected through the gpio 5v.
It's a bit of a compromise because it bypasses the PTC protection described above but you can adjust the supply limiting to help there. I had intermittent connection issues with the pin connectors until I crushed them in a little to tighten them. It kept getting throttle indicators in Octoprint before that.
Since then no issues. I have fine control over the voltage and current limiting via the buck p/s.