I think 4000BC would be too early... lots of stuff happen in between. A pity
The longstanding "humans win all ties" was abolished with Civ IV. Starting with Civ IV things changed from everything built at the begining of the turn counter turn to as everybody's turn comes around their buildings get built. So you were beat out by one turn.
The building hammers (and research and so on) are appileid the moment you hit "End Turn". It goes like this:
Player 1 moves his units. Player 1 Hits "End Turn". Player 1 gets his hammers, Science,... Applied.
Player 2 moves his units. Player 2 Hits "End Turn" and gets all the stuff applied.
Player 3, ... N moves, ends turn,
Player 1 gets notified about finished builds, techs and gets prompted to choose new builds, techs...
Player 1 moves his units. While moving units, Player 1 gets to see the messages about what happened since he hit "End Turn"
If you can't read code you can illustrate it in a experiments (Set it up in WB if you want):
You can whipp a Unit in a city that is going to be attaked - you will see the notification about the unit beeing built later on your next turn, but the unit will be avaiable to defend the city from attack during AI turn.
Meaning that if you hit the "End Turn" button, while it says "1 Turn left" (for tech, wonders, whatever) you get this. There is just no other player beeing processed before the build/tech is applied.
If you were beaten by 1 turn, you would have seen the message saying "Religion founded somewhere else" while your tech bar is displaying "1 left".
There is however a slight delay in displaying the message, so if you was playing fast - as those are early game turns - you might have seen the message too late. You can however check the log - all messages are added to the log - before you actually see them.