Don't include profile name in node names for HFP and A2DP. Instead, append the id number from the spa.bluez5 backend. The backend takes care of choosing the unique id numbers appropriately.
This makes the sink/source names the same for A2DP and HFP. This allows outputs directed to the Bluetooth device to remain there when switching profiles between A2DP and HFP, without needing to determine the new sink/source name.