Pathfinder 1e was originally billed as being 100% backwards compatible with D&D 3.x (because it is D&D 3.5 with some extra polish).
So try to get your hands on a copy of the Stronghold Builder's Guidebook, it has everything you could need for that, and more.
If you can get a hold of it (or just pick it up in PDF from drivethru RPG), i recommend checking out the stronghold builder's guidebook.
It's a 3E supplement, but most of the "rules" on it are pretty system agnostic, and costs could generally be used as-is. It has a lot of rules around building this sort of stuff, and is generally my go-to for this sort of thing.
If i remember correctly, as far as taxing goes, it has some suggestions that revolve around "taxes from the people = some percentage of the total building cost".
So this isn't Pathfinder canon, but there is a softcover book called Stronghold Builder's Guidebook. The book was released for D&D 3.0 and covers the costs of building a stronghold that can be as small as a 1 bedroom hovel or as large as a castle.
you could try This.
> Goblins
Actually, I think they'd be more likely to strike as soon as the party makes themselves comfortable - as in, they settle down for the night - after clearing a large infestation.
> Recruiting soldiers at different cities
Don't forget to implement Charisma checks (Diplomacy) for recruiting soldiers. A well-spoken, seemingly good leader will be more efficient at recruiting than a completely uncharismatic Wizard.
Keep in mind you can hire a dozen spearmen at any village for a barrel of mead and a gold coin, but given enough time you'll train them up to elite levels. Provided they don't skip fortress (which seems realistic). Recruiting experienced soldiers at cities will save time, but not gold in that case.
And, IIRC, pay for a trained soldier is between 1 silver and 1 gold coin (1 gp = 10 sp)... at least in 3.5.
No idea what edition are you playing, but Stronghold Builder's Guide has plenty of material not restricted by editions. Book of Challenges also has a pile on info for making in-built castle and dungeon protection mechanisms (read: traps).
Finally, take a look at Stirling Castle, Scotland. I came across it fairly recently, been drooling ever since. It looks amazing. Only needs some adjustments for a fantasy setting - for example, protection against flying enemies.
Happy DMing! :)
I know 3rd edition D&D had the stronghold builders guidebook.