Is there a limit to how many blocks can be rolled back from a 51% attack? I was wondering if we where to ever face a 51% attack is there some sort of limit as to when the longest chain doesn't matter? For example if I owned 51%+ of the network, mined 1000 blocks privately and the rest of the network was at block 990 and then I broadcast the data would everyone switch to my chain and would the last 990 blocks be orphaned?
For example if I owned 51%+ of the network, mined 1000 blocks privately and the rest of the network was at block 990 and then I broadcast the data would everyone switch to my chain and would the last 990 blocks be orphaned?


This can certainly happen. There is no limit on how many blocks can be reorganized. However, while nodes will still perform the action to rollback those 900 blocks and replace them with the 1000 privately mined ones, there will be lots of warnings if this does happen as Bitcoin Core (the most commonly used node software) has checks for large work blockchain reorganizations. These checks will trigger warnings if there are reorgs of more than a few blocks so that the node operator can take action if necessary.