Check out Fedify. There are still advantages to bespoke protocol implementation, but this is the closest we've gotten so far to "protocol-in-a-box", and it's great.
As a biased[0] party I must mention that the Go programming language has at least one and a half libraries in the form of Go-Fed[1] and Go-ActivityPub[2].