There are two matters here:
(1) David's fear
(2) Place of worship/sacrifice
I will examine these in the opposite order for reasons that will become obvious shortly.
- Place of Worship/sacrifice
Deut 12 is very clear that when Israel settled in their conquered land, they were to have a single place of national worship. Ellicott sums this well when he comments on Deut 12:5 -
(5) But unto the place which the Lord your God shall choose out of all
your tribes.—The very form of the order proves its antiquity. No one
who was acquainted with the removal of that “place” from Shiloh to
Nob, from Nob to Gibeon, from Gibeon to Jerusalem, could have written
with such utter unconsciousness of later history as these words imply.
It is noticeable that in the reading of this precept in the times of
our Lord, the Jews seem to have arrived at the came state of
unconsciousness. They could not conceive of the presence or worship of
Jehovah anywhere but at Jerusalem.
Note that this single place of national worship was moved from, initially Shiloh, and later to Nob, then Gibeon and finally to Jerusalem, is immaterial for our discussion at present other than to note that, with one exception, each move was a plenary move, ie, of the entire sanctuary apparatus, including the altars and the sanctuary itself.
The conspicuous exception was the last move occurring soon after David became king, conquered Jerusalem, and built a palace in Jerusalem. When this occurred, the sanctuary was still (as the OP points out) still in Gibeon.
However, David decided that he wanted the Ark of the Covenant with him in Jerusalem. This was highly irregular - to separate the Ark of the Covenant from the Sanctuary and all the other machinery of national worship; but, good or bad, that is what David did. 2 Sam 6. (It was not until about 40+ years later when Solomon completed the temple that all the rest of the sanctuary equipment was moved to Jerusalem, into the new temple.)
Side note: As stated above, the sanctuary's primary function was to provide a single focus of NATIONAL worship. This did not prevent others having small private or individual sacrifices such as occurred with Samuel and David and others on various occasions. This was what David felt necessary when the plague was stayed and he offered private sacrifices on Mt Moriah, just outside of Jerusalem, on what was to become the temple site.
- David's Fear
2 Sam 24 and 1 Chron 21 record the unfortunate lapse of David's humility when he counted the fighting men. His confrontation by the prophet Gad resulted in the realization of his great sin followed by extreme remorse.
The previous occasion of David's sin with Bathsheba had taught David the subtle distinction between forgiveness and consequences - David lost four of his sons because of his public sin.
Thus, it is possible that David's fear of going to the sanctuary at Gibeon might have been based on at least two things:
- his extreme remorse and sense of sinfulness, and thus unworthiness to go to Gibeon
- his possible fear of further consequences of his sin (other than the three-day plague)
In any case, David decided on a private sacrifice as a symbol of his penitence and contrition where the angel of death had been seen and the plague stopped.