The way you negate Posse Comitatus is to turn civilian police into de facto US military.
I personally don’t consider military patrolling the border to be a violation of Posse Comitatus. I fail to see how its taking on police duties when the feds have a mandate to protect the borders anyway.
The Coasties patrol the Detroit river and nobody considers it to be a violation. In fact much of what they do is the same as police do on land.