OSM2psql is a handy tool for importing OSM data into a PostgreSQL database. Though, the created database cannot be converted back to a PBF file. For example, to use a routing algorithm (e.g., Graphhopper) with a custom weighting, the PBF format is needed. For this, I used Osmosis.
For the task of editing a PBF file and re-creating a new PBF file I used the following process: