United States Treasury bonds and notes are called "risk-free" because there is effectively zero risk of default by the lender. This is because the US Treasury can, if needed, simply "print money"* to pay its debts.
These bonds do carry other risks, for example that inflation could reduce the value of the payments below the original purchase amount.
And bonds from other governments, such as municipalities in the U.S., or even other national governments that don't control their own currency, do carry default risk. These governments also don't generally borrow at the same rate as the US Treasury does.
When I read finance textbooks, I read things like "assume that the risk-free rate is equal to the yield on 30-year government bonds", "the government bond earns at the risk-free rate", "the cash is invested in a risk-free asset... such as government bonds",
These were probably just written from a US-centric perspective. It doesn't apply to all governments, only to the one that the writer assumes most of their readers are familiar with.
I also find it hard to believe that this applies to all government bonds of the world.
It doesn't.
If government bonds are not risk-free, should the "risk-free rate" be lower than the yield on 30-year government bonds?
It depends how you're using the "risk-free rate". In many cases, you're just considering it as a kind of reference rate, or a base rate for comparing other investments.
In any given government's jurisdiction, isn't there some risk of natural disasters, societal collapse, revolution, conquest, etc.?
Any risk that could lead to default by the US Treasury would also very likely lead to default by other US issuers, so "risk-free" treasury bonds don't carry any risks that other bonds in the same market don't also carry.
Similarly, in other countries, if the economy collapses, or the country is conquered, other issuers selling bonds in that country's currency are likely to default (whether literally or effectively due to currency devaluation) along with the national government. So even though it isn't truly risk-free, the government's borrowing rate provides a useful reference for the rate paid by the lowest-risk borrowers in that market.
* The Treasury doesn't literally print paper money (that's a function of the federal reserve banks, which aren't technically part of the government), but could, in principle, produce a coin of arbitrary value.